Data query method, device, electronic device and computer-readable storage medium
By determining the location information and address information of the target data block in the data table and storing the target data in different memories, the problem of long querying of data blocks is solved, and querying multiple target data in one clock cycle is achieved, which improves the processing efficiency of the server.
Patent Information
- Application Number
- CN202210455302.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-24
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2042-04-24
AI Technical Summary
In the prior art, the query timing of data blocks is relatively long and consumes a lot of hardware area.
By determining the location information of the target data block corresponding to the data query request in the data table, determining the address information of the target data based on the location information, and storing the target data in different memories, each memory is used to query one data within one clock cycle.
During the query process of target data blocks, querying multiple target data is completed in one clock cycle, saving query time costs and reducing hardware consumption, and improving server processing efficiency.
Smart Images

Figure CN114741328B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology. Specifically, this application relates to a data query method, apparatus, electronic device, and computer-readable storage medium. Background Art
[0002] With the development of Internet and artificial intelligence technologies, signal processing of images or videos and application of machine learning-related algorithms are becoming more and more widespread. In the above-mentioned signal processing and machine learning algorithm-related scenarios, querying data blocks in a data table is usually involved. A data block contains multiple data. In the related art, since querying each data in the data block requires one clock cycle, querying the data block usually requires multiple clock cycles, resulting in a long query timing for the data block and consuming a large amount of hardware area. Summary of the Invention
[0003] The purpose of this application aims to solve at least one of the above technical defects, especially the technical defect of the long query timing of the data block.
[0004] According to one aspect of this application, a data query method is provided. The method includes:
[0005] Receiving a data query request, and determining first position information of a target data block corresponding to the data query request in a data table;
[0006] According to the first position information, determining address information of target data included in the target data block; wherein, the address information includes a target address of the target data in a corresponding memory; the target data block includes at least two pieces of the target data stored in different memories;
[0007] Obtaining the target data according to the address information.
[0008] Optionally, before determining the first position information of the target data block corresponding to the data query request in the data table, the method further includes:
[0009] Receiving data, dividing the data into multiple first data blocks, where the number of data in the first data block is greater than or equal to the number of the target data in the target data block;
[0010] Writing the first data blocks into the data table in a preset order.
[0011] Optionally, the receiving data and dividing the data into multiple first data blocks includes:
[0012] If the number of the received data is greater than the number of data in the first data block, caching the data in a data stack in the order of data reception;
[0013] Divide the data in the data stack into the first data block according to the data reception order.
[0014] Optionally, dividing the received data into a plurality of first data blocks includes:
[0015] If the number of the received data is less than the number of data in the first data block, cache the data in the data stack according to the data reception order;
[0016] Until the number of the received data is greater than or equal to the number of data in the first data block, divide the data in the data stack into the first data block according to the data reception order.
[0017] Optionally, the method further includes:
[0018] Store each piece of data into a corresponding memory according to the second position information of the data in the first data block;
[0019] Wherein, the memories corresponding to each piece of data are different.
[0020] Optionally, the method further includes:
[0021] Determine a first correspondence relationship between the third position information of the data in the data table and the address of the data in the corresponding memory.
[0022] Optionally, the determining, according to the first position information, the address information of the target data included in the target data block includes:
[0023] Determine the fourth position information of each piece of target data in the data table according to the first position information;
[0024] Determine the address information of the target data corresponding to the fourth position information according to the first correspondence relationship.
[0025] According to another aspect of the present application, there is provided a data query device, and the device includes:
[0026] A first determination module, configured to receive a data query request and determine first position information of a target data block corresponding to the data query request in a data table;
[0027] A second determination module, configured to determine address information of target data included in the target data block according to the first position information; wherein, the address information includes a target address of the target data in a corresponding memory; the target data block includes at least two pieces of the target data stored in different memories;
[0028] An acquisition module, configured to acquire the target data according to the address information.
[0029] According to another aspect of the present application, an electronic device is provided, which includes:
[0030] One or more processors;
[0031] A memory;
[0032] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to: execute the data query method according to any one of the first aspects of the present application.
[0033] For example, according to a third aspect of the present application, a computing device is provided, including: a processor, a memory, a communication interface, and a communication bus, and the processor, the memory, and the communication interface complete communication with each other through the communication bus;
[0034] The memory is used to store at least one executable instruction, and the executable instruction causes the processor to execute the operations corresponding to the data query method as shown in the first aspect of the present application.
[0035] According to still another aspect of the present application, a computer-readable storage medium is provided, and when the computer program is executed by a processor, it implements the data query method according to any one of the first aspects of the present application.
[0036] For example, according to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, and a computer program is stored on the computer-readable storage medium, and when the program is executed by a processor, it implements the data query method as shown in the first aspect of the present application.
[0037] According to one aspect of the present application, a computer program product or a computer program is provided, and the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementation manners of the above first aspect.
[0038] The beneficial effects brought by the technical solution provided by the present application are:
[0039] In the embodiment of the present application, the first position information of the target data block corresponding to the data query request is determined in the data table; according to the first position information, the address information of the target data included in the target data block is determined; according to the address information, the target data is obtained; wherein, since each target data in the target data block is respectively stored in different memories, and each memory can query one data within one clock; in this way, when querying the target data block, multiple target data in the target data block can be queried within one clock cycle, thereby saving the query time cost and reducing the hardware consumption, and improving the processing efficiency of the server. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for description in the embodiments of the present application.
[0041] Figure 1 It is a schematic flowchart of a data query method provided by an embodiment of the present application;
[0042] Figure 2 It is a schematic diagram of an application scenario of a data query method provided by an embodiment of the present application;
[0043] Figure 3 It is a schematic diagram of an application scenario of a data query method provided by an embodiment of the present application;
[0044] Figure 4 It is a schematic diagram of an application scenario of a data query method provided by an embodiment of the present application;
[0045] Figure 5 It is a schematic diagram of an application scenario of a data query method provided by an embodiment of the present application;
[0046] Figure 6 It is a schematic diagram of the hardware architecture of a data query method provided by an embodiment of the present application;
[0047] Figure 7 It is a schematic diagram of the structure of a data query device provided by an embodiment of the present application;
[0048] Figure 8 It is a schematic diagram of the structure of an electronic device for data query provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0049] The embodiments of the present application will be described below with reference to the drawings in the present application. It should be understood that the embodiments described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application, and do not constitute limitations on the technical solutions of the embodiments of the present application.
[0050] Those skilled in the art can understand that, unless specifically stated otherwise, the singular forms "a", "an", "the" and "said" used herein may also include the plural forms. It should be further understood that the terms "comprising" and "including" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation of other features, information, data, steps, operations, elements, components and / or their combinations supported by the technical field of the present invention. It should be understood that when we say an element is "connected" or "coupled" to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term. For example, "A and / or B" can be implemented as "A", or implemented as "B", or implemented as "A and B".
[0051] To make the objectives, technical solutions and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.
[0052] The data query method, device, electronic device and computer-readable storage medium provided by the present application are intended to solve the above technical problems in the prior art.
[0053] The following uses specific embodiments to detail the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems. These several specific embodiments below can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
[0054] See Figure 1 , the embodiments of the present application provide a data query method. Optionally, this method is applied to an electronic device. For ease of description, the following takes this method applied to a server as an example to introduce the embodiments of the present application; the server may include a processor. For example, the processor may be a CPU. Specifically, this method may include the following steps:
[0055] S101: Receive a data query request, and determine the first position information of the target data block corresponding to the data query request in the data table.
[0056] Optionally, the embodiments of the present application can be applied to a data query scenario, specifically, it can be applied to the query of the target data block in the data table.
[0057] In an embodiment of the present application, by way of example, the data table may be a Translation Lookaside Buffer (TLB) data table. The data table includes a plurality of data blocks; the target data block is the data block requested in the data query request. Specifically, the target data block may be any data block in the data table; the target data block may contain at least two pieces of data, and the data contained in the target data block is target data.
[0058] Each data block has position information in the data table. For example, its position information is represented by the coordinates of the data block in the data table. The first position information includes the position of the target data block in the data table; for example, the first position information may include the coordinates of the target data block in the data table. Among them, the coordinates of the target data block in the data table may be the row number and / or column number of the target data block in the data table, etc.
[0059] By way of example, take Figure 2 the data table shown in Figure 2 as an example for illustration. As shown in
[0060] the data table may contain multiple rows and multiple columns of data. The target data block may be any data block in the data table. Among them, the target data block may include a plurality of adjacent target data; in addition, the target data block may also include a plurality of discrete target data that are not adjacent in position.
[0061] As a first case: The target data block may include a plurality of adjacent target data. For example, the target data block may be the 1x3 target data block A shown in the figure, that is, the target data block A contains 3 target data, and the 3 target data are distributed in one row and three columns in the data table. Another example, the target data block may be the 2x2 target data block B1 shown in the figure, that is, the target data block B1 contains 4 target data, and the 4 target data are distributed in two rows and two columns in the data table. By the same token, the target data block may also be a 3x3 target data block C, a 4x4 target data block D, etc. It should be noted that the above-exemplified data blocks are only for illustrative purposes, and the present application does not limit the number of data contained in the data block.
[0061] As a second case: The target data block includes a plurality of discrete target data that are not adjacent in position. For example, the target data block may be the 2x2 target data block E shown in the figure, that is, the target data block E contains 4 target data, and the 4 target data are distributed in two rows and two columns in the data table. Among them, the 4 target data distributed in two rows and two columns are not adjacent. As Figure 2 shown, the 4 target data are respectively located at the 5th row and 13th column, the 5th row and 16th column, the 8th row and 13th column, and the 8th row and 16th column in the data table.
[0062] It can be understood that in the embodiments of the present application, any one or more data in the target data block can also be queried. For example, taking the data block in Figure 2 as the data block D, the target data block is a 4x4 data block (i.e., a data block with 4 rows and 4 columns). Then, in the embodiments of the present application, any data or any sub-data block in the data block can be queried; among them, the sub-data block can be a data block smaller than 4x4 (a data block with the number of rows less than 4 and the number of columns less than 4). For example, the sub-data block can be a 1x2 data block, a 2x3 data block, and so on.
[0063] It should be noted that for the target data blocks in the above two cases, the first position information may include the coordinates of some target data in the target data block in the data table and the positional relationship between multiple target data. For example, taking the 2x2 target data block B1 shown in Figure 2 as an example, the first position information of the target data block B1 may include the coordinates (0, 0) of the target data a located in the upper left corner of the target data block (the coordinates can be the row number and column number where the target data is located) and the positional relationship between the target data a and other target data in the target data block, or the position of the target data a in the target data block, etc.
[0064] In addition, as another case, the first position information of the target data block in the data table may also include the coordinates of each target data in the target data block in the data table. For example, taking the 1x3 target data block A shown in Figure 2 as an example, the first position information of the target data block A may include the coordinates where the 3 target data are located in the data table, that is, the 3 target data are respectively located in the 14th column of the 1st row, the 15th column of the 1st row, and the 16th column of the 1st row in the data table.
[0065] In the embodiments of the present application, the server can determine the first position information of the target data block corresponding to the data query request in the data table according to the data query request.
[0066] S102: Determine the address information of the target data included in the target data block according to the first position information; where the address information includes the target address of the target data in the corresponding memory; the target data block includes at least two pieces of the target data stored in different memories.
[0067] Specifically, in the related art, since a target data block contains multiple target data, querying each target data in the target data block requires one clock cycle. That is to say, querying the data block requires multiple clock cycles. In the embodiments of the present application, each target data in the target data block is separately stored in a different memory. In this way, it is possible to query the target data block in one clock cycle, thereby saving query timing and reducing hardware consumption.
[0068] Optionally, the memory may include a memory such as a Static Random-Access Memory (SRAM).
[0069] After determining the first position information of the target data block in the data table in step S101 above, the address information of the target data may be determined according to the first position information. Wherein, the address information includes the target address of the target data in the corresponding memory.
[0070] Optionally, in the embodiments of the present application, there may be a corresponding relationship (for convenience of description, the corresponding relationship may be referred to as the first corresponding relationship) between the position information (such as row number and column number) of the data in the data table and the address of the data in the corresponding memory. In this way, the position information of each target data in the data table can be determined first according to the position of each target data in the target data block and the first position information of the target data block in the data table; then, the address information of the target data can be determined according to the first corresponding relationship and the position information of each target data in the data table.
[0071] S103: Obtain the target data according to the address information.
[0072] After determining the address information of the target data, the target data can be obtained according to the address information.
[0073] The data query method in the embodiments of the present application can be widely applied to various data query scenarios. For example, it can be applied to the image recognition scenario of artificial intelligence; specifically, in the image recognition scenario, in the two-dimensional feature matrix corresponding to the person image, any target data block can be queried to identify the image; for example, the feature data of the data block corresponding to the face can be queried to identify the face image; another example is that the feature data of the data block corresponding to the eyes in the face can also be queried to identify the eye image, and so on.
[0074] In an embodiment of the present application, after receiving a data query request, the server determines the first position information of the target data block corresponding to the data query request in the data table, and determines the address information of the target data included in the target data block according to the first position information; finally, according to the address information, the target data is obtained; in this way, when querying the target data block, multiple target data can be queried in one clock cycle, saving the query time cost, reducing the hardware consumption, and improving the processing efficiency of the server.
[0075] In an embodiment of the present application, in order to store the target data in the target data block in different memories respectively, and there is a first corresponding relationship between the position information of the target data in the data table and the address of the target data in the corresponding memory; in an embodiment of the present application, the following data writing process may further be included:
[0076] Before determining the first position information of the target data block corresponding to the data query request, the method further includes:
[0077] Receiving data, dividing the data into multiple first data blocks, and the number of data in the first data block is greater than or equal to the number of the target data in the target data block;
[0078] Writing the first data blocks into the data table in a preset order.
[0079] Specifically, the first data block can be understood as the basic unit for writing the data into the data table. That is to say, when the data is written into the data table, it is written in units of the first data block, that is, one first data block is written in each clock cycle.
[0080] Among them, when receiving data, based on the different number of the received data, the process of dividing the data into multiple first data blocks can be divided into the following situations:
[0081] Situation 1: In an embodiment of the present application, the receiving data and dividing the data into multiple first data blocks includes:
[0082] If the number of the received data is greater than the number of data in the first data block, then buffer the data in the data stack according to the data receiving order;
[0083] Divide the data in the data stack into the first data blocks according to the data receiving order.
[0084] Specifically, when the number of the received data is greater than the number of data in the first data block, the received data can be first cached in a data stack according to the data reception order; then, according to the principle of "first in, first out" of the data stack, the data in the data stack are respectively divided into the first data blocks. It should be noted here that since the data is pushed into the stack according to the data reception order, when the data is popped out of the stack and divided into the first data blocks, it is actually popped out of the stack according to the data reception order.
[0085] For example, taking the number of data included in the first data block as 4 as an example for illustration: when the number of received data is 10, the 10 data can be first cached in a data stack according to the data reception order; then, according to the stack - out order, every 4 of the 10 data are divided into a first data block. Among them, since the 10 data can be divided into two first data blocks, the remaining 2 data can continue to be cached in the data stack. After receiving subsequent data, when the data in the data stack is greater than or equal to 4, it is continued to be divided into the first data blocks.
[0086] Case 2: In an embodiment of the present application, the receiving data and dividing the data into multiple first data blocks includes:
[0087] If the number of the received data is less than the number of data in the first data block, the data is cached in a data stack according to the data reception order;
[0088] Until the number of the received data is greater than or equal to the number of data in the first data block, the data in the data stack is divided into the first data blocks according to the data reception order.
[0089] Specifically, when the number of the received data is less than the number of data in the first data block, the received data can be first cached in a data stack according to the data reception order; continue to receive data and cache the received data into the data stack; until the number of the received data is greater than or equal to the number of data in the first data block, then according to the principle of "first in, first out" of the data stack, the data in the data stack are respectively divided into the first data blocks.
[0090] For example, still taking the number of data included in the first data block as 4 as an example for illustration: when the number of received data is 2, the 2 data can be first cached in a data stack according to the data reception order; then, continue to receive data. After receiving subsequent data, when the data in the data stack is greater than or equal to 4, the data in the data stack can be popped out and divided into the first data blocks.
[0091] Case 3: In an embodiment of the present application, when the number of received data is equal to the number of data in the first data block, the data can be directly divided into the first data block.
[0092] Further, to achieve that there is a first correspondence between the position information of the target data in the data table and the address of the target data in the corresponding memory, the first data block can be written into the data table in a preset order.
[0093] Specifically, in combination with Figure 2 , taking the first data block as a 2x2 data block as an example for illustration: When writing the first data block into the data table, to facilitate determining the first correspondence, each first data block can be written into the data table in the order of data block division (that is, in the order of data reception). For example, the first first data block (i.e., data block B1) is located in rows 0 to 1 and columns 0 to 1; the second first data block (i.e., data block B2) is located in rows 2 to 3 and columns 2 to 3; the third first data block (i.e., data block B3) is located in rows 4 to 5 and columns 4 to 5... and so on. In this way, it can be understood that when the first data block is written, it is written in the row and column order in the data table.
[0094] In an embodiment of the present application, the method further includes:
[0095] According to the second position information of the data in the first data block, each of the data is respectively stored in the corresponding memory;
[0096] wherein, the memories corresponding to each of the data are different.
[0097] Specifically, the second position information includes the position of the data in the first data block.
[0098] In an embodiment of the present application, each of the data can be respectively stored in the corresponding memory according to the second position information.
[0099] In combination with Figures 3 to 4 , taking the number of data included in the first data block as 4 as an example for illustration:
[0100] The 4 data in the first data block can be respectively stored in SARM0, SARM1, SARM2, and SARM3. Among them, as Figure 3As shown, taking the first data block Case0 as an example, each of the data is stored according to its position in the first data block. That is, the data at the upper left corner of the first data block (data 0) can be stored in SARM0; the data at the upper right corner of the first data block (data 0) can be stored in SARM1; the data at the lower left corner of the first data block (data 10) can be stored in SARM2; the data at the lower right corner of the first data block (data 8) can be stored in SARM3. Additionally, as Figure 4 As shown, taking the first data block Case0 as an example, each of the data is stored according to its position in the first data block. That is, the data at the upper left corner of the first data block (data 0) can be stored in SARM0; the data at the upper right corner of the first data block (data 0) can be stored in SARM1; the data at the lower left corner of the first data block (data 8) can be stored in SARM2; the data at the lower right corner of the first data block (data 8) can be stored in SARM3.
[0101] In addition, it should also be noted that in the above embodiments, the number of data in the first data block is greater than or equal to the number of the target data in the target data block. It can be understood here that when querying data, the target data block to be queried can be a subset of the first data block, that is, the number of the target data in the target data block is less than or equal to the number of data in the first data block. In this way, the target data in the target data block are respectively stored in different memories.
[0102] In an embodiment of the present application, the method further includes:
[0103] Determine a first correspondence relationship between the third position information of the data in the data table and the address of the data in the corresponding memory.
[0104] Specifically, the third position information is the position of the data in the data table.
[0105] In the embodiments of the present application, since the data in the data table is written in the first data block as a basic unit, for data tables generated based on different first data blocks, the first correspondence relationship between the third position information of the data in the data table and the address of the data in the corresponding memory is also different.
[0106] Combined with Figure 3As shown, taking the 2x2 data block as the first data block as an example for illustration. As shown in the figure, the positions of the 2x2 data blocks in the data table can include four cases, namely the four cases shown as Case0, Case1, Case2, and Case3 in the figure. Among them, the data in the upper left corner of data block Case0 is located in an even row and an even column; the data in the upper left corner of data block Case1 is located in an even row and an odd column; the data in the upper left corner of data block Case2 is located in an odd row and an even column; the data in the upper left corner of data block Case3 is located in an odd row and an odd column.
[0107] In the embodiments of the present application, for the data table generated in units of the above-mentioned 2x2 data blocks, the first correspondence relationship can be described by the following data relationship, that is, Read address = x * H + y. Wherein, Read address represents the address of the data in the corresponding memory; the coefficient x is determined according to the row coordinate (row) of the data in the data table; the coefficient y is determined according to the column coordinate (col) of the data in the data table; H represents the depth of the data table.
[0108] For the four cases of the positions of the above-mentioned 2x2 data blocks, that is, the four cases shown as Case0, Case1, Case2, and Case3 in the figure, when determining the addresses of the data stored in SARM0, SARM1, SARM2, and SARM3, the specific determination methods of the coefficients x and y can be referred to Table 1:
[0109]
[0110]
[0111] Table 1
[0112] As shown in Table 1, taking the data stored in SARM0 as an example, for the case of Case0: x = row / 2, y = col / 2; for the case of Case1: x = row / 2, y = col / 2 + 1; for the case of Case2: x = row / 2 + 1, y = col / 2; for the case of Case3: x = row / 2 + 1, y = col / 2 + 1.
[0113] In an embodiment of the present application, determining the address information of the target data included in the target data block according to the first position information includes:
[0114] According to the first position information, respectively determine the fourth position information of each target data in the data table;
[0115] According to the first correspondence relationship, determine the address information of the target data corresponding to the fourth position information.
[0116] Specifically, the fourth position information is the position of the data in the data table.
[0117] It should be noted that for the convenience of description and distinction, in the embodiment of the present application, during the data reading stage, that is, when querying data, the position of the data in the data table is described as the fourth position information; during the data writing stage, the position of the data in the data table is described as the third position information. That is to say, the third position information and the fourth position information are only used for distinction in descriptions at different stages.
[0118] In the embodiment itself, in combination with the example where the above first data block is a 2x2 data block, according to the first position information of the target data block in the data table, on the one hand, the fourth position information of each target data in the data table can be determined, and on the other hand, it can also be determined which case among Case0 to Case3 the position of the target data block in the data table belongs to.
[0119] Based on the different cases where the position of the target data block in the data table corresponds to Case0 to Case3, according to the first correspondence relationship, the address information of the target data corresponding to the fourth position information can be determined.
[0120] As an example, in combination with Figure 5 and Figure 6 as shown, in the corresponding memory, according to the address information of the target data, the corresponding target data can be obtained. For example Figure 5 as shown, for data block case0, the target data can be obtained from the corresponding memory respectively according to the address information of each data in the corresponding memory.
[0121] In addition, Figure 6 is the hardware architecture diagram of the embodiment of the present application. As Figure 6 shown, in the embodiment of the present application, the first position information of the target data block in the data table (the first position information such as the number of rows row and the number of columns col) can be input through the input port, such as the addr2pos port or the row, col port in the figure; then the high address (addr high) or the low address function (addr low) can be started respectively; and then the queried target data can be output. Among them, the embodiment of the present application can provide multiple query functions, such as function 1 (function-lut1) outputs all the data in the target data block, function 2 (function-lut2) outputs part of the data in the target data block, and so on.
[0122] In the embodiment of the present application, the first position information of the target data block corresponding to the data query request is determined in the data table; according to the first position information, the address information of the target data included in the target data block is determined; according to the address information, the target data is obtained; wherein, since each target data in the target data block is respectively stored in different memories, and each memory can query one data within one clock; thus, when querying the target data block, multiple target data in the target data block can be queried within one clock cycle, thereby saving the query time cost and reducing the hardware consumption, and improving the processing efficiency of the server.
[0123] The embodiment of the present application provides a data query device, as Figure 7 shown, the data query device 70 may include: a first determination module 701, a second determination module 702, and an acquisition module 703, wherein,
[0124] The first determination module 701 is configured to receive a data query request and determine the first position information of the target data block corresponding to the data query request in the data table;
[0125] The second determination module 702 is configured to determine the address information of the target data included in the target data block according to the first position information; wherein, the address information includes the target address of the target data in the corresponding memory; the target data block includes at least two target data stored in different memories;
[0126] The acquisition module 703 is configured to obtain the target data according to the address information.
[0127] In an embodiment of the present application, the device further includes a writing module, configured to, before determining the first position information of the target data block corresponding to the data query request in the data table,
[0128] receive data, divide the data into multiple first data blocks, the number of data in the first data block being greater than or equal to the number of target data in the target data block;
[0129] write the first data blocks into the data table in a preset order.
[0130] In an embodiment of the present application, the writing module is specifically configured to, if the number of received data is greater than the number of data in the first data block, cache the data in a data stack in the data reception order;
[0131] divide the data in the data stack into the first data blocks according to the data reception order.
[0132] In an embodiment of the present application, the writing module is specifically configured to cache the data in the data stack in the order of data reception if the number of the received data is less than the number of data in the first data block;
[0133] Until the number of the received data is greater than or equal to the number of data in the first data block, divide the data in the data stack into the first data block according to the data reception order.
[0134] In an embodiment of the present application, the device further includes a storage module, configured to store each piece of the data in a corresponding memory according to the second position information of the data in the first data block;
[0135] Wherein, the memory corresponding to each piece of the data is different.
[0136] In an embodiment of the present application, the device further includes a correspondence determination module, configured to determine a first correspondence between the third position information of the data in the data table and the address of the data in the corresponding memory.
[0137] In an embodiment of the present application, the second determination module is specifically configured to respectively determine the fourth position information of each piece of the target data in the data table according to the first position information;
[0138] Determine the address information of the target data corresponding to the fourth position information according to the first correspondence.
[0139] The device in the embodiment of the present application can execute the method provided in the embodiment of the present application, and its implementation principle is similar. The actions performed by each module in the device in the embodiments of the present application correspond to the steps in the method in the embodiments of the present application. For the detailed function descriptions of the modules of the device, reference can be specifically made to the descriptions in the corresponding methods shown above, and details are not described herein again.
[0140] In the embodiment of the present application, by determining the first position information of the target data block corresponding to the data query request in the data table; according to the first position information, determining the address information of the target data included in the target data block; according to the address information, obtaining the target data; wherein, since each piece of the target data in the target data block is respectively stored in different memories, and each memory can query one piece of data within one clock; in this way, when querying the target data block, multiple pieces of the target data in the target data block can be queried within one clock cycle, thereby saving the query time cost and reducing the hardware consumption, and improving the processing efficiency of the server.
[0141] An electronic device is provided in an embodiment of the present application. The electronic device includes: a memory and a processor; at least one program stored in the memory and, when executed by the processor, can achieve, compared with the prior art: by determining the first position information of a target data block corresponding to a data query request in a data table; according to the first position information, determining the address information of the target data included in the target data block; and according to the address information, obtaining the target data; wherein, since each target data in the target data block is respectively stored in different memories, and each memory can query one data within one clock cycle; thus, when querying the target data block, multiple target data in the target data block can be queried within one clock cycle, thereby saving the query time cost and reducing the hardware consumption, and improving the processing efficiency of the server.
[0142] In an alternative embodiment, an electronic device is provided, as Figure 8 shown. Figure 8 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. Among them, the processor 4001 and the memory 4003 are connected, such as connected through a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, and the transceiver 4004 may be used for data interaction between this electronic device and other electronic devices, such as data sending and / or data receiving, etc. It should be noted that in practical applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation to the embodiments of the present application.
[0143] The processor 4001 may be a CPU (Central Processing Unit, central processor), a general-purpose processor, a DSP (Digital Signal Processor, data signal processor), an ASIC (Application Specific Integrated Circuit, application-specific integrated circuit), an FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in connection with the disclosure of the present application. The processor 4001 may also be a combination for implementing computing functions, such as a combination including one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0144] The bus 4002 may include a path for transmitting information between the above components. The bus 4002 can be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 only a thick line is used in Figure 8 , but it does not mean that there is only one bus or one type of bus.
[0145] The memory 4003 can be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, or it can also be an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0146] The memory 4003 is used to store the application program code (computer program) for executing the solution of this application, and is controlled by the processor 4001 to execute. The processor 4001 is used to execute the application program code stored in the memory 4003 to implement the content shown in the foregoing method embodiments.
[0147] Among them, the electronic device includes but is not limited to: mobile phones, laptop computers, multimedia players, desktop computers, etc.
[0148] The embodiment of this application provides a computer-readable storage medium, on which a computer program is stored. When it runs on a computer, it enables the computer to execute the corresponding content in the foregoing method embodiments.
[0149] In the embodiment of the present application, the first position information of the target data block corresponding to the data query request is determined in the data table; according to the first position information, the address information of the target data included in the target data block is determined; according to the address information, the target data is obtained; wherein, since each target data in the target data block is respectively stored in different memories, and each memory can query one data within one clock; thus, when querying the target data block, the query of multiple target data in the target data block can be completed within one clock cycle, thereby saving the query time cost and reducing the hardware consumption, and improving the processing efficiency of the server.
[0150] The terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the specification, claims and drawings of the present application are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than the illustrated or textually described order.
[0151] It should be understood that although the flowchart in the embodiment of the present application indicates each operation step by an arrow, the execution order of these steps is not limited by the order indicated by the arrow. Unless there is a clear description in this article, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be executed in other orders according to requirements. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage among these sub-steps or stages can also be executed at different times. In the scenario where the execution times are different, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and the embodiment of the present application does not limit this.
[0152] The above are only optional implementation manners of some implementation scenarios of the present application. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the technical concept of the solution of the present application, other similar implementation means based on the technical idea of the present application also belong to the protection scope of the embodiments of the present application.
Claims
1. A data query method, characterized in that, Including: Receiving a data query request and determining first position information of a target data block corresponding to the data query request in a data table; Determining address information of target data included in the target data block according to the first position information; wherein, the address information includes a target address of the target data in a corresponding memory; the target data block includes at least two pieces of the target data stored in different memories; Obtaining the target data according to the address information; Wherein, the determining the address information of the target data included in the target data block according to the first position information specifically includes: Respectively determining position information of each piece of the target data in the data table according to the first position information; Determining, according to a first correspondence relationship, address information of the target data corresponding to the position information of each piece of the target data in the data table; wherein, the first correspondence relationship represents a correspondence relationship between the position information of each piece of data in the data table and the address of each piece of data in a corresponding memory.
2. The data query method according to claim 1, wherein Before determining the first position information of the target data block corresponding to the data query request in the data table, the method further includes: Receiving data, dividing the data into a plurality of first data blocks, and the number of data in the first data block is greater than or equal to the number of the target data in the target data block; Writing the first data blocks into the data table in a preset order.
3. The data query method according to claim 2, wherein The receiving data and dividing the data into a plurality of first data blocks includes: If the number of the received data is greater than the number of data in the first data block, caching the data in a data stack according to the data receiving order; Dividing the data in the data stack into the first data blocks according to the data receiving order.
4. The data query method according to claim 2, wherein The receiving data and dividing the data into a plurality of first data blocks includes: If the number of the received data is less than the number of data in the first data block, caching the data in a data stack according to the data receiving order; Until the number of the received data is greater than or equal to the number of data in the first data block, dividing the data in the data stack into the first data blocks according to the data receiving order.
5. The data query method according to claim 2, wherein The method further includes: Respectively storing each piece of the data into a corresponding memory according to second position information of the data in the first data block; Wherein, the memory corresponding to each piece of the data is different.
6. A data query device, characterized in that, Including: A first determination module, configured to receive a data query request and determine first position information of a target data block corresponding to the data query request in a data table; A second determination module, configured to determine address information of target data included in the target data block according to the first position information; wherein, the address information includes a target address of the target data in a corresponding memory; the target data block includes at least two pieces of the target data stored in different memories; An obtaining module, configured to obtain the target data according to the address information; The second determination module is specifically configured to: Respectively determine position information of each piece of the target data in the data table according to the first position information; Determine the address information of each target data corresponding to the position information of each target data in the data table according to the first correspondence relationship; wherein, the first correspondence relationship represents the correspondence relationship between the position information of each data in the data table and the address of each data in the corresponding memory.
7. An electronic device, characterized in that, The electronic device includes: One or more processors; A memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to: execute the data query method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the data query method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Data processing method, device and equipment and storage medium
CN111581216A
Data query method and device, electronic equipment and computer readable storage medium
CN111897812A