Data query method, device, computer storage medium and accelerator card
By using the acceleration core to perform data query operations in parallel in the acceleration card, the inefficient query problem caused by insufficient computing power of the main computing device is solved, and the effect of improving query efficiency and processing efficiency is achieved.
Patent Information
- Application Number
- CN202311430885.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-31
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2043-10-31
AI Technical Summary
When queries data in the database, the main computing device lacks computing power, resulting in low query efficiency.
By using the acceleration core in the acceleration card, the target data set, the data set to be queried and the query parameters sent by the main computing device, and perform query operations on multiple target data in the to be queried data based on the query conditions, obtaining each Query results of target data.
The computing power consumption of data processing on the main computing device is reduced, and other tasks executed in the main computing device are avoided affecting the data query efficiency, thereby improving the processing efficiency, and further improving the query efficiency through parallel query operations.
Smart Images

Figure CN117331970B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of data processing technology, and in particular to a data query method, device, computer storage medium, and acceleration card. Background Art
[0002] Currently, when data is queried in a database, it is usually implemented by executing an index nested loop function through a main computing device. The index nested loop function determines a driving table and a driven table, takes the data in the driving table as the target, queries the target in the driven table, and outputs the query results.
[0003] However, since the computing power of the main computing device is limited and multiple data processing tasks need to be performed, the computing power of the main computing device is insufficient, resulting in low query efficiency. Summary of the invention
[0004] In view of this, embodiments of the present application provide a data query method, device, computer storage medium and acceleration card to at least partially solve the above problems.
[0005] According to a first aspect of an embodiment of the present application, a data query method is provided, which is used for an acceleration card connected to a main computing device, the acceleration card including an acceleration core, and the data query method includes: receiving a target data set, a data set to be queried and query parameters sent by the main computing device, the target data set including multiple target data, the data set to be queried including multiple data to be queried, and the query parameters including query conditions; through the acceleration core, based on the query conditions, executing query operations on multiple target data in parallel in the data set to be queried, to obtain query results for each target data, so that the main computing device reads the query results, wherein the query operation refers to matching the data to be queried that meets the query conditions in the data set to be queried for each target data, and outputting information on the successfully matched target data and information on the data to be queried as query results.
[0006] According to a second aspect of an embodiment of the present application, a data query device is provided, which is an acceleration card connected to a main computing device, the acceleration card including an acceleration core, and the data query device including a data receiving module and a data query module, wherein the data receiving module is used to receive a target data set, a data set to be queried and query parameters sent by the main computing device, the target data set includes multiple target data, the data set to be queried includes multiple data to be queried, and the query parameters include query conditions; the data query module is used to perform query operations on multiple target data in parallel in the data set to be queried based on the query conditions through the acceleration core, and obtain query results for each target data, so that the main computing device reads the query results, wherein the query operation refers to matching the data to be queried that meets the query conditions in the data set to be queried for each target data, and outputting the information of the successfully matched target data and the information of the data to be queried as the query result.
[0007] According to a third aspect of an embodiment of the present application, an acceleration card is provided, comprising a storage area and an acceleration core, wherein the storage area is used to store a target data set, a data set to be queried and query parameters received from a main computing device, and to store query results, wherein the target data set includes multiple target data, the data set to be queried includes multiple data to be queried, and the query parameters include query conditions; the acceleration core is used to execute query operations on multiple target data in parallel in the data set to be queried based on the query conditions, and obtain query results for each target data, so that the main computing device reads the query results, wherein the query operation refers to matching the data to be queried that meets the query conditions for each target data in the data set to be queried, and outputting information on the successfully matched target data and information on the data to be queried as query results.
[0008] According to a fourth aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect is implemented.
[0009] The data query method, device, computer storage medium and acceleration card of the embodiment of the present application, wherein the data query method is used for an acceleration card connected to a main computing device, and the acceleration card includes an acceleration core, including: receiving a target data set, a data set to be queried and a query parameter sent by the main computing device, the target data set includes multiple target data, the data set to be queried includes multiple data to be queried, and the query parameter includes a query condition; through the acceleration core, based on the query condition, in the data set to be queried, a query operation on multiple target data is performed in parallel, and a query result for each target data is obtained, so that the main computing device reads the query result, wherein the query operation refers to matching the data to be queried that meets the query condition in the data set to be queried for each target data, and outputting the information of the successfully matched target data and the information of the data to be queried as the query result. The entire data processing process of this embodiment is completed in the acceleration card, and the main computing device only needs to send data and read the processing results, thereby reducing the occupation of the computing power of the main computing device by data processing, avoiding other tasks performed in the main computing device affecting the data query efficiency, thereby improving the processing efficiency; in addition, the acceleration core performs query operations on multiple target data in parallel in the data set to be queried based on the query condition, which can further improve the query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0011] Figure 1 A schematic diagram of an application scenario of a data query method according to an exemplary embodiment of the present application;
[0012] Figure 2 is a flowchart of a data query method according to an exemplary embodiment of the present application;
[0013] Figure 3 is a flowchart of the steps of a data query method according to another exemplary embodiment of the present application;
[0014] Figure 4 It is a structural block diagram of a data query device according to an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0015] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.
[0016] Before describing the data query method according to the embodiment of the present application, the application scenario of the data query method is briefly described to facilitate understanding.
[0017] Reference Figure 1 , Figure 1 1 is a schematic diagram of an application scenario of a data query method according to an exemplary embodiment of the present application. The data query method of this embodiment can be used in an acceleration card connected to a main computing device.
[0018] Among them, the main computing device is a device that performs the task of data query, and the acceleration card is an auxiliary device plugged into the main computing device and used to improve the processing speed of the main computing device in a certain aspect. For example, the acceleration card has a standard PCIe interface and can be plugged into the computing device through a PCIE slot. PCIE refers to PCI-Express, which is a bus and interface standard. The acceleration card and the main computing device can transmit data through the PCIE transmission channel. In this embodiment, the acceleration card is used to increase the speed of data processing of the main computing device.
[0019] The main computing device can be a client or a server. It can be a desktop computer, a laptop computer, a mobile phone, a PDA, a dedicated terminal, or a cluster of several terminals. In addition, it can also be a part divided from a terminal, such as a virtual machine. The accelerator card can be an auxiliary device, such as a card plugged into a card slot, or it can be another independent device connected to the main computing device through an interface. This embodiment does not limit this.
[0020] In this embodiment, the main computing device performs a task. When a part of the task requires data query, the data related to the data query is transmitted to the accelerator card. After the accelerator card obtains the query result of the data query, the main computing device reads the data query from the accelerator card, thereby reducing the computing power occupied by the main computing device for data processing, avoiding other tasks executed in the main computing device affecting the efficiency of data query, and thus improving the query efficiency.
[0021] like Figure 1As shown, the main computing device includes a processor (Central Processing Unit, CPU) and a memory. The processor is a core component for executing the tasks of the main computing device. The memory is a component that stores the data required for the tasks of the main computing device, as well as the intermediate results and final results generated by the main computing device executing the tasks. For example, the target data set, the data set to be queried, and the query parameters in this embodiment are also stored in the memory. When it is necessary to execute a data query, the processor calls the target data set, the data set to be queried, and the query parameters from the memory, and sends them to the acceleration card through the transmission channel between the main computing device and the acceleration card.
[0022] The accelerator card includes an acceleration core. The acceleration core is a processing unit in the accelerator card for querying data. The accelerator card may also include a storage area, which is an area in the accelerator card for storing data. For example, the storage area may be a double data rate synchronous dynamic random access memory (DDR). Since the accelerator card has an acceleration core and a storage area, when performing data query, it can receive the relevant data required for data query at one time, without having to perform data transmission with the main computing device multiple times, thereby reducing data transmission overhead.
[0023] Reference Figure 2 , showing a step flow chart of a data query method according to an exemplary embodiment of the present application.
[0024] The data query method of this embodiment is used for an accelerator card connected to a main computing device, wherein the accelerator card includes an acceleration core, and specifically includes the following steps:
[0025] S202: Receive a target data set, a data set to be queried, and query parameters sent by a main computing device.
[0026] The target data set includes multiple target data, the to-be-queried data set includes multiple to-be-queried data, and the query parameters include query conditions.
[0027] Exemplarily, the target data set and the to-be-queried data set are two sets of data to be queried, wherein the target data in the data set is the query object used for querying, and the to-be-queried data in the to-be-queried data set is the queried object. Both the target data and the to-be-queried data can be data of any data type among INT32, INT64, DECIMAL32, DECIMAL64, etc., and this embodiment does not limit this. The amount of data contained in the target data set and the to-be-queried data set can be the same or different, and this embodiment does not limit this. The data type of the target data and the to-be-queried data is the same. The query condition is used to determine whether each to-be-queried parameter in the to-be-queried data set is the target to-be-queried data for each target data. The query condition may include any one of the six operators, such as "==", "!=", "not equal to", ">", ">=", ">=", "< ...
[0028] S204. Based on the query conditions, query operations on multiple target data are executed in parallel in the data set to be queried through the acceleration core to obtain query results for each target data, so that the main computing device can read the query results.
[0029] The query operation refers to matching each target data with the data to be queried that meets the query conditions in the data set to be queried, and outputting the information of the successfully matched target data and the information of the data to be queried as the query result.
[0030] Exemplarily, the acceleration core can perform query operations on multiple target data in parallel in the data set to be queried based on the query conditions. For example, the target data set can be [1, 2, 7, 9, 5, 1, 4, 2], the data set to be queried can be [3, 5, 1, 10, 3, 1], and the query condition can be "==", that is, the target data to be queried that is equal to each target data in the data set to be queried is synchronously matched, and the information of the successfully matched target data and the information of the data to be queried are output as query results. For example, for the first target data "1", the target data to be queried that matches "==1" in the data to be queried can determine that the third data to be queried and the sixth data to be queried in the data set to be queried are the successfully matched target data to be queried, and then the information of the first target data and the information of the third and sixth data to be queried are output as query results. The information of the target data can refer to the position information of the target data in the target data set, and the information of the data to be queried can refer to the position information of the data to be queried in the data set to be queried.
[0031] In an optional implementation, the target data set also includes a first index value corresponding to the target data, and the to-be-queried data set also includes a second index value corresponding to the to-be-queried data. For each target data, the to-be-queried data set that meets the query condition is matched in the to-be-queried data set, and the information of the successfully matched target data and the information of the to-be-queried data are output as query results, including: for each target data, the to-be-queried data set that meets the query condition is matched in the to-be-queried data set until the to-be-queried data set is traversed; the first index value corresponding to the target data that matches the query condition is output as a first query result to obtain the information of the target data; the second index value corresponding to the to-be-queried data that matches the query condition is output as a second query result to obtain the information of the to-be-queried data, and the information of the target data and the information of the to-be-queried data are output as query results.
[0032] Exemplarily, the target data set also includes a first index value corresponding to the target data, and the data set to be queried also includes a second index value corresponding to the data to be queried. The first index value in the target data set may be a serial number numbered according to the position order of the target data. For example, when the target data set is [1,2,7,9,5,1,4,2], the corresponding first index value may be [0,1,2,3,4,5,6,7]. Similarly, when the data set to be queried is [3,5,1,10,3,1], the corresponding second index value may be [0,1,2,3,4,5]. This embodiment does not limit this. For each target data, the data set to be queried that meets the query condition is matched in the data set to be queried until the data set to be queried is traversed, and the first index value corresponding to the target data that matches the query condition is output as the first query result, and the second index value corresponding to the data to be queried that matches the query condition is output as the second query result. Wherein, each time the match is successful, the corresponding first index value of the target data and the second index value of the data to be queried are output. For example, the query condition is "==", for the target data "1" with the first index value of "0", the target data to be queried that matches "==1" in the data to be queried can be determined to be the target data to be queried with the second index value of "2" and the target data to be queried with the second index value of "5" as the successfully matched target data to be queried, then the output first index value will be [0,0], and the output second index value will be [2,5]. Similarly, by querying other target data in the target data set, the first query result can be [0,0,4,5,5], and the second query result can be [2,5,1,2,5].
[0033] In this implementation, by traversing the data set to be queried, for each target data, the data to be queried that meets the query conditions is matched in the data set to be queried; the first index value corresponding to the target data that matches the query conditions is output as the first query result to obtain the information of the target data; the second index value corresponding to the data to be queried that matches the query conditions is output as the second query result to obtain the information of the data to be queried, and the information of the target data and the information of the data to be queried are output as the query result. The first index value corresponding to the successfully matched target data and the second index value corresponding to the data to be queried are used as the information of the target data and the information of the data to be queried, that is, the output query result, so that the expression of the query result is simple and clear.
[0034] The data query method in this embodiment is used for an acceleration card connected to a main computing device, and the acceleration card includes an acceleration core, including: receiving a target data set, a data set to be queried, and a query parameter sent by the main computing device, wherein the target data set includes multiple target data, the data set to be queried includes multiple data to be queried, and the query parameter includes a query condition; through the acceleration core, based on the query condition, query operations on multiple target data are performed in parallel in the data set to be queried, and query results for each target data are obtained, so that the main computing device reads the query result, wherein the query operation refers to matching the data to be queried that meets the query condition in the data set to be queried for each target data, and outputting the information of the successfully matched target data and the information of the data to be queried as the query result. The entire data processing process of this embodiment is completed in the acceleration card, and the main computing device only needs to send data and read the processing results, thereby reducing the occupation of the computing power of the main computing device by data processing, avoiding other tasks performed in the main computing device from affecting the data query efficiency, thereby improving the processing efficiency; in addition, the acceleration core performs query operations on multiple target data in parallel in the data set to be queried based on the query condition, which can further improve the query efficiency.
[0035] Reference Figure 3 , showing a step flow chart of a data query method according to an exemplary embodiment of the present application.
[0036] The accelerator card in this embodiment also includes a storage area, which is used to store the received target data set, the data set to be queried and the query parameters. The specific steps of the data query method in this embodiment include:
[0037] S302: Receive a target data set, a data set to be queried, and query parameters sent by a main computing device.
[0038] The target data set includes multiple target data, the to-be-queried data set includes multiple to-be-queried data, and the query parameters include query conditions.
[0039] It should be noted that step S302 can be implemented with reference to the specific implementation of step S202 above, which will not be described in detail here.
[0040] S304 , reading the target data set, the data set to be queried, and the query parameters from the storage area through the acceleration core.
[0041] Exemplarily, the storage area of the accelerator card stores data according to storage units, so the target data set and the data set to be queried are divided into storage units according to the storage unit length in the storage area. The storage unit length is assumed to be 64 bits, that is, 64 bits. For example, the data types in the target data set and the data set to be queried are both INT64, that is, each data occupies 64 bits. Assume that the target data set contains 20 target data, that is, 20*64=1280 bits, and the data set to be queried contains 30 target data, that is, 30*64=1920 bits. Therefore, the 1280-bit target data and the 1920-bit data to be queried are respectively allocated to multiple storage units with a data width of 64 bits. The storage area stores query parameters, which is also based on a similar principle.
[0042] The target data set includes multiple target data, the to-be-queried data set includes multiple to-be-queried data, and the query parameter may further include the data volume of the target data included in the target data set and the data volume of the to-be-queried data included in the to-be-queried data set.
[0043] In an optional implementation, the target data set, the data set to be queried, and the query parameters are read from the storage area by the acceleration core, including: reading the query parameters from the storage area by the acceleration core; based on a preset transmission data volume, reading the target data set to obtain at least one target sub-data set, and reading the data set to be queried to obtain at least one sub-data set to be queried.
[0044] Exemplarily, the preset transmission data volume is the data volume of a single transmission in the storage area. The preset transmission data volume is determined by the hardware of the accelerator card. The preset transmission data volume can be determined by a person skilled in the art according to the hardware characteristics of the specific accelerator card used, and this embodiment does not limit this. Among them, since the data volume of the target data set and the data set to be queried may not be an integer multiple of the preset transmission data volume, the last target sub-data set or the sub-data set to be queried contains some valid data and some invalid data. The location information of the invalid data in the last target sub-data set and the sub-data set to be queried can be determined by the data volume of the target data contained in the target data set included in the query parameters, the data volume of the data to be queried included in the data set to be queried, and the above-mentioned preset transmission data volume. For example, assuming that the target data set contains 20 target data, that is, 20*64=1280bit, and the data set to be queried contains 30 target data, that is, 30*64=1920bit. The preset transmission data volume can be 512 bits. Based on the preset transmission data volume of 512 bits, that is, 8 data (the data types in the target data set and the data set to be queried are both INT64), the target data set (for example, the data volume is 20) is read to obtain 3 target sub-data sets, and the data set to be queried (for example, the data volume is 30) is read to obtain 4 sub-data sets to be queried. It can be determined that the last target sub-data set includes 256 bits of valid data and 256 bits of invalid data, that is, 4 valid data and 4 invalid data; the last sub-data set to be queried includes 384 bits of valid data and 128 bits of invalid data, that is, 6 valid data and 2 invalid data. When querying, the invalid data in the target sub-data set and the sub-data set to be queried is not queried.
[0045] In this implementation, by setting a preset transmission data volume, the target sub-dataset and the sub-dataset to be queried can be read from the storage area in batches until the target data set and the data set to be queried are read. Therefore, when the data volume of the target data set and the data set to be queried is too large, data processing can be performed in batches according to the hardware processing capability of the accelerator card, so that the data processing performance of the accelerator card during the data query process is in the best state, thereby making the query efficiency higher.
[0046] In an optional implementation, based on a preset transmission data volume, the target data set is read to obtain at least one target sub-data set, and the to-be-queried data set is read to obtain at least one to-be-queried sub-data set, including: based on the preset transmission data volume, the target data set is divided into at least one target sub-data set, and the to-be-queried data set is divided into at least one to-be-queried sub-data set; the target sub-data set and the to-be-queried sub-data set are read from the storage area in cycles. In each cycle, one target sub-data set is read, and within each cycle, the to-be-queried sub-data set is read in batches, and one to-be-queried sub-data set is read in each batch, until the target data set and the to-be-queried data set are read completely.
[0047] Exemplarily, in the above example, the target data set is divided into 3 target sub-data sets, and the data set to be queried is divided into 4 sub-data sets to be queried. The target sub-data set and the sub-data set to be queried are read from the storage area in an accelerated core periodicity. Among them, one target sub-data set is read in each period, and the sub-data set to be queried is read in batches in each period, and one sub-data set to be queried is read in each batch. For example, 3 target sub-data sets need to be read in 3 periods. In the first period, the first target sub-data set is read, and the sub-data set to be queried is read in batches, and one sub-data set to be queried is read in each batch, and processed until the 4 sub-data sets to be queried are read. Then, the second period is entered to read the second target sub-data set, and the sub-data set to be queried is read in batches, and one sub-data set to be queried is read in each batch, and processed until the 4 sub-data sets to be queried are read. The above process is repeated until the target sub-data set and the sub-data set to be queried are read.
[0048] In this implementation, the target sub-dataset and the sub-dataset to be queried are read from the storage area in cycles. One target sub-dataset is read in each cycle, and the sub-dataset to be queried is read in batches within each cycle, and one sub-dataset to be queried is read in each batch until the target data set and the data set to be queried are read. This allows query operations to be performed on each target sub-dataset in cycles and batches in the future, so that the data processing performance of the accelerator card during the data query process is in the best state, thereby making the query efficiency higher.
[0049] S306: Based on the query conditions, query operations on multiple target data are performed in parallel in the data set to be queried, query results for each target data are obtained, and the query results are written into the storage area.
[0050] It should be noted that the "based on the query conditions, query operations on multiple target data are performed in parallel in the data set to be queried to obtain query results for each target data" in step S306 can be implemented with reference to the specific implementation of the above step S204, which will not be described in detail here. Finally, the acceleration core writes the obtained query results to the storage area, and the writing method can be a burst mode, which is not limited in this embodiment.
[0051] In an optional implementation, based on the query conditions, query operations on multiple target data are executed in parallel in the data set to be queried to obtain query results for each target data, including: for the target data in the target sub-data set read in each cycle, according to the query conditions, query operations on multiple target data are executed in parallel in each sub-data set to be queried until all sub-data sets to be queried are traversed to obtain sub-query results corresponding to each cycle; and multiple sub-query results are integrated to obtain query results.
[0052] For example, assuming that the query condition is "==", according to the preset transmission data volume, the target data set is read to obtain 2 target sub-data sets, and the data set to be queried is read to obtain 2 sub-data sets to be queried. Then the 2 target sub-data sets need to be read in 2 cycles, and each cycle reads 2 sub-data sets to be queried respectively, and obtains the sub-query results corresponding to each cycle. For example, in the first cycle, the first target data subset read is [11, 2, 7, 9, 5, 1, 4, 2], and the first sub-data set to be queried read in the first batch in the first cycle is [3, 5, 1, 10, 3, 1]. The query operation is performed on each target data in the first target data subset, and finally the query results corresponding to the first batch can be obtained. Assuming that the second batch reads the second subset of data to be queried as [0,1,4,7,3,0], and performs query operations on each target data in the first target data subset again, the query results corresponding to the second batch can be finally obtained. By integrating the query results corresponding to the first batch and the query results corresponding to the second batch, the sub-query results corresponding to the first cycle can be obtained, that is, the sub-query results corresponding to the first target sub-data set. Similarly, the sub-query results corresponding to the second cycle can be obtained in the above manner, that is, the sub-query results corresponding to the second target sub-data set. By integrating the two sub-query results, the final query result can be obtained, that is, the query result corresponding to the target data set.
[0053] In this implementation, for the target data in the target sub-dataset read in each cycle, according to the query conditions, query operations on multiple target data are performed in parallel in each sub-dataset to be queried, until all sub-datasets to be queried are traversed to obtain the sub-query results corresponding to each cycle; multiple sub-query results are integrated to obtain the query results. This ensures that the query operations for each target sub-dataset traverse all sub-datasets to be queried for querying, and then outputs the query results, avoiding the problem of missing or repeated queries for a sub-dataset to be queried.
[0054] In an optional implementation, writing the query result to the storage area includes: segmenting and splicing the data in the query result according to a preset transmission data volume to obtain multiple query result data segments; and writing the query result data segments to the storage area in batches.
[0055] For example, assuming that in the first cycle, the first target data subset read is [1,2,7,9,5,1,4,2], the corresponding first index value is [0,1,2,3,4,5,6,7], and the first data subset to be queried in the first batch in the first cycle is [3,5,1,10,3,1], and the corresponding second index value is [0,1,2,3,4,5]. A query operation is performed on each target data in the first target data subset, and finally the query result of the target data corresponding to the first batch is [0,0,4,5,5], and the query result of the data to be queried is [2,5,1,2,5]. At this time, both the target data query results and the to-be-queried data query results have not reached the preset transmission data volume (for example, 512 bits, i.e., 8 data). Assuming that the second batch reads the second to-be-queried data subset as [0,1,4,7,3,0], the corresponding second index value is [6,7,8,9,10,11]. The query operation is performed again for each target data in the first target data subset. Finally, the target data query results corresponding to the second batch are [0,2,5], and the to-be-queried data query results are [7,9,7]. Then the target data query results [0,0,4,5,5] corresponding to the first batch and the target data query results [0,2,5] corresponding to the second batch are spliced and output as the query result data segment [0,0,4,5,5,0,2,5] corresponding to the target data, and the query results [2,5,1,2,5] corresponding to the first batch of data to be queried and the query results [7,9,7] corresponding to the second batch of data to be queried are spliced and output as the query result data segment [2,5,1,2,5,7,9,7] corresponding to the data to be queried. The obtained query result data segments are written to the storage area in batches, that is, one query result data segment is written each time. Similarly, if the query results obtained in a batch exceed the preset transmission data volume, the query results are segmented to obtain query result data segments equal to the preset transmission data volume. If the segmentation generates partial data less than the preset transmission data volume, it is spliced with the query results of the next batch to obtain query result data segments equal to the preset transmission data volume. Through the above process, the query results obtained are segmented and / or spliced until all the query results are written into the storage area.
[0056] In this implementation, the data in the query result is segmented and spliced according to the preset transmission data volume to obtain multiple query result data segments; the query result data segments are written to the storage area in batches. This ensures that the amount of data written to the storage area by the acceleration core each time reaches the preset transmission data volume, which can optimize the data transmission performance between the acceleration core and the storage area, reduce the number of times data is written to the storage area, and thus improve the efficiency of data writing.
[0057] S308. Return processing completion information to the main computing device, so that the main computing device reads all query results from the storage area.
[0058] Exemplarily, after the data query is completed, the acceleration core returns processing completion information to the main computing device. For example, the acceleration core can return processing completion information to the main computing device while writing the query result to the storage area; or, after writing the query result to the storage area, the acceleration core can return processing completion information to the main computing device. This embodiment does not limit this. After the main computing device receives the processing completion information, the processor reads the query result from the storage area and transmits it to the memory for storage.
[0059] In this embodiment, the accelerator card also includes a storage area, which is used to store the received target data set, the data set to be queried, and the query parameters. The target data set, the data set to be queried, and the query parameters are read from the storage area by the acceleration core; based on the query conditions, query operations on multiple target data are performed in parallel in the data set to be queried to obtain query results for each target data, and the query results are written into the storage area; and processing completion information is returned to the main computing device so that the main computing device reads all query results from the storage area. Since the accelerator card has a storage area, when performing data query, it can receive all relevant data required for data query from the main computing device at one time, without having to perform data transmission with the main computing device multiple times, thereby reducing the data transmission overhead.
[0060] Reference Figure 4 , shows a structural block diagram of a data query device according to an exemplary embodiment of the present application.
[0061] The data query device of this embodiment is used for an acceleration card connected to a main computing device, the acceleration card includes an acceleration core, and the data query device includes a data receiving module 402 and a data query module 404 .
[0062] Among them, the data receiving module 402 is used to receive the target data set, the data set to be queried and the query parameters sent by the main computing device, the target data set contains multiple target data, the data set to be queried contains multiple data to be queried, and the query parameters include query conditions; the data query module 404 is used to execute query operations on multiple target data in parallel in the data set to be queried based on the query conditions through the acceleration core, and obtain query results for each target data, so that the main computing device can read the query results, wherein the query operation refers to matching the data to be queried that meets the query conditions for each target data in the data set to be queried, and outputting the information of the successfully matched target data and the information of the data to be queried as the query results.
[0063] In an optional implementation, the acceleration card also includes a storage area, which is used to store the received target data set, the data set to be queried and the query parameters. The data query module 404 is also used to: read the target data set, the data set to be queried and the query parameters from the storage area through the acceleration core; based on the query conditions, execute query operations on multiple target data in parallel in the data set to be queried, obtain query results for each target data, and write the query results to the storage area; return processing completion information to the main computing device, so that the main computing device reads all query results from the storage area.
[0064] In an optional implementation, the data query module 404 is also used to: read query parameters from the storage area through the acceleration core; based on a preset transmission data volume, read the target data set to obtain at least one target sub-data set, and read the data set to be queried to obtain at least one sub-data set to be queried, wherein the preset transmission data volume is the amount of data transmitted by the storage area in a single transmission.
[0065] In an optional implementation, the data query module 404 is further used to: divide the target data set into at least one target sub-data set based on a preset transmission data volume, and divide the data set to be queried into at least one sub-data set to be queried; read the target sub-data set and the sub-data set to be queried from the storage area in periods, wherein one target sub-data set is read in each period, and read the sub-data set to be queried in batches within each period, wherein one sub-data set to be queried is read in each batch, until the target data set and the data set to be queried are read.
[0066] In an optional implementation, the data query module 404 is also used to: for the target data in the target sub-data set read in each cycle, according to the query conditions, execute query operations on multiple target data in parallel in each sub-data set to be queried, until all sub-data sets to be queried are traversed to obtain the sub-query results corresponding to each cycle; integrate multiple sub-query results to obtain the query results.
[0067] In an optional implementation, the data query module 404 is further used to: segment and splice the data in the query result according to a preset transmission data volume to obtain multiple query result data segments; and write the query result data segments into the storage area in batches.
[0068] The data query device of this embodiment is used to implement the corresponding data query methods in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here. In addition, the functional implementation of each module in the data query device of this embodiment can refer to the description of the corresponding parts in the aforementioned method embodiments, which will not be repeated here.
[0069] An embodiment of the present application also provides an acceleration card, which includes a storage area and an acceleration core.
[0070] The storage area is used to: store a target data set, a data set to be queried, and query parameters received from the main computing device, and store query results, wherein the target data set includes multiple target data, the data set to be queried includes multiple data to be queried, and the query parameters include query conditions;
[0071] The acceleration core is used to: based on the query conditions, execute the query operation on multiple target data in parallel in the data set to be queried, obtain the query result for each target data, so that the main computing device can read the query result, wherein the query operation refers to matching the data to be queried that meets the query conditions in the data set to be queried for each target data, and output the information of the successfully matched target data and the information of the data to be queried as the query result
[0072] An embodiment of the present application further provides a computer storage medium on which a computer program is stored. When the program is executed by a processor, the data query method as described in any one of the above-mentioned multiple method embodiments is implemented.
[0073] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to execute operations corresponding to the data query method described in any one of the above-mentioned multiple method embodiments.
[0074] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0075] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a special-purpose processor or programmable or special-purpose hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown here, the execution of the code converts the general-purpose computer into a special-purpose computer for executing the method shown here.
[0076] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0077] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.
Claims
1. A data query method, characterized in that: An accelerator card connected to a main computing device, the accelerator card is used to increase the data processing speed of the main computing device, the accelerator card includes an acceleration core, and the data query method includes: Receiving a target data set, a data set to be queried, and query parameters sent by the main computing device, wherein the target data set includes a plurality of target data, the data set to be queried includes a plurality of data to be queried, and the query parameters include query conditions; By means of the acceleration core, based on the query condition, query operations on the plurality of target data are performed in parallel in the data set to be queried, and query results for each target data are obtained, so that the main computing device reads the query results, wherein the query operation refers to matching the data to be queried that meets the query condition in the data set to be queried for each target data, and outputting information of the successfully matched target data and information of the data to be queried as the query result; The target data set also includes a first index value corresponding to the target data, and the to-be-queried data set also includes a second index value corresponding to the to-be-queried data. The step of matching the target data with the data to be queried that meets the query condition in the data set to be queried for each target data, and outputting the information of the successfully matched target data and the information of the data to be queried as the query result includes: For each of the target data, matching the data to be queried that meets the query condition in the data set to be queried until the data set to be queried is traversed; The first index value corresponding to the target data that matches the query condition is output as a first query result to obtain information about the target data; the second index value corresponding to the data to be queried that matches the query condition is output as a second query result to obtain information about the data to be queried, the information about the target data and the information about the data to be queried are aggregated, and the aggregated result is output as the query result.
2. The data query method according to claim 1, characterized in that: The acceleration card further includes a storage area, the storage area is used to store the received target data set, the data set to be queried and the query parameter, and the query operation on the multiple target data is performed in parallel in the data set to be queried based on the query condition by the acceleration core to obtain the query result for each target data, so that the main computing device reads the query result, including: Reading the target data set, the data set to be queried, and the query parameter from the storage area through the acceleration core; Based on the query condition, query operations on the multiple target data are performed in parallel in the to-be-queried data set to obtain query results for each target data, and the query results are written into the storage area; Return processing completion information to the main computing device, so that the main computing device reads all the query results from the storage area.
3. The data query method according to claim 2, characterized in that: The reading the target data set, the data set to be queried, and the query parameter from the storage area by the acceleration core includes: Reading the query parameter from the storage area through the acceleration core; Based on a preset transmission data volume, the target data set is read to obtain at least one target sub-data set, and the to-be-queried data set is read to obtain at least one to-be-queried sub-data set, wherein the preset transmission data volume is the data volume of a single transmission of the storage area.
4. The data query method according to claim 3, characterized in that: The method of reading the target data set to obtain at least one target sub-data set and reading the to-be-queried data set to obtain at least one to-be-queried sub-data set based on the preset transmission data volume comprises: Based on a preset transmission data volume, the target data set is divided into at least one target sub-data set, and the to-be-queried data set is divided into at least one to-be-queried sub-data set; The target sub-dataset and the sub-dataset to be queried are read from the storage area in cycles, wherein one target sub-dataset is read in each cycle, and the sub-dataset to be queried is read in batches within each cycle, wherein one sub-dataset to be queried is read in each batch, until the target data set and the data set to be queried are completely read.
5. The data query method according to claim 4, characterized in that: The query operation on the plurality of target data is performed in parallel in the to-be-queried data set based on the query condition to obtain a query result for each target data, including: For the target data in the target sub-data set read in each cycle, query operations on the multiple target data are performed in parallel in each of the sub-data sets to be queried according to the query conditions, until all the sub-data sets to be queried are traversed to obtain sub-query results corresponding to each cycle; The multiple sub-query results are integrated to obtain the query result.
6. The data query method according to claim 2, characterized in that: The step of writing the query result into the storage area comprises: According to the preset transmission data volume, the data in the query result is segmented and spliced to obtain multiple query result data segments; The query result data segments are written into the storage area in batches.
7. A data query device, characterized in that: An accelerator card for connecting to a main computing device, wherein the accelerator card includes an acceleration core, including: A data receiving module, configured to receive a target data set, a data set to be queried, and query parameters sent by the main computing device, wherein the target data set includes a plurality of target data, the data set to be queried includes a plurality of data to be queried, and the query parameters include query conditions; A data query module is used to perform query operations on the multiple target data in parallel in the data set to be queried based on the query conditions through the acceleration core to obtain query results for each target data so that the main computing device can read the query results, wherein the query operation refers to matching the data to be queried that meets the query conditions in the data set to be queried for each target data, and outputting the information of the successfully matched target data and the information of the data to be queried as the query result.
8. An accelerator card, characterized in that: The accelerator card is used to increase the data processing speed of the main computing device, including: A storage area, used to store a target data set, a data set to be queried, and query parameters received from the main computing device, and store query results, wherein the target data set includes a plurality of target data, the data set to be queried includes a plurality of data to be queried, and the query parameters include query conditions; The acceleration core is used to perform query operations on the multiple target data in parallel in the data set to be queried based on the query conditions, and obtain query results for each target data, so that the main computing device can read the query results, wherein the query operation refers to matching the data to be queried that meets the query conditions for each target data in the data set to be queried, and outputting the information of the successfully matched target data and the information of the data to be queried as the query results; the target data set also includes a first index value corresponding to the target data, and the data set to be queried also includes a second index value corresponding to the data to be queried, The step of matching the target data with the data to be queried that meets the query condition in the data set to be queried for each target data, and outputting the information of the successfully matched target data and the information of the data to be queried as the query result includes: For each of the target data, matching the data to be queried that meets the query condition in the data set to be queried until the data set to be queried is traversed; The first index value corresponding to the target data that matches the query condition is output as a first query result to obtain information about the target data; the second index value corresponding to the data to be queried that matches the query condition is output as a second query result to obtain information about the data to be queried, the information about the target data and the information about the data to be queried are aggregated, and the aggregated result is output as the query result.
9. A computer storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Data processing method and server
CN108108472A
Data processing system and method, and storage medium
CN116795875A