Topk data query method, system, device, storage medium and electronic device
By obtaining the target data set in the data processing node and distributing the target threshold, the topk data in the distributed storage computing node is filtered out, which solves the problems of low topk query efficiency and high IO pressure in the distributed database, and realizes efficient data query. and reduce the load on server nodes.
Patent Information
- Application Number
- CN202410278761.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-12
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-03-12
AI Technical Summary
In the distributed computing mode, when finding the topk data in the distributed database, the amount of data is large and there are many nodes, the IO demand is high and the efficiency is low, resulting in problems of delay and low retrieval accuracy.
By obtaining the target data set in the data processing node, determining the target threshold based on the data volume, scaling factor and k value, and distributing it to the distributed storage computing node, filtering out the data that meets the threshold, reducing the IO pressure and calculation amount of the server node .
It improves the efficiency of topk data query, reduces the IO pressure on server nodes, reduces the calculation amount of data processing nodes, and improves query performance in distributed computing mode.
Smart Images

Figure CN118152453B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data query, and in particular to a topk data query method, system, device, storage medium and electronic device. Background Art
[0002] Topk is defined as finding the largest (or smallest) k elements from a set of elements. It is widely used in scenarios such as information recommendation, information search, information ranking, data matching, and data cleaning.
[0003] In a distributed computing mode (distributed database), in general, if you need to filter out the topk data from N data in a distributed database, multiple physical nodes are required to calculate the results at the same time, and then report the calculation results of all physical nodes to the server node, which aggregates these calculation results together, performs further sorting or screening, and then obtains the global topk value. However, when the amount of data is large and there are many distributed physical nodes, if all the calculation results are aggregated and uploaded to the server node or processing unit node, the demand for IO will be very large, and the response speed will be greatly reduced, resulting in delays. For example, when the N data stored in the distributed database are in the order of 100 million, 1 billion or more, and the order of k is in the order of 1 million, when searching for the topk among the N, if all the data is transmitted and then sorted to find the topk, the efficiency will be very low and the demand for IO will be very large.
[0004] Especially in the storage-computing integrated computing structure, distributed computing is mostly used. Due to its fast computing speed, it is widely used in large model reasoning, data retrieval, vector retrieval and other fields. However, due to the influence of storage-computing integrated devices and system structure, its IO ports are limited and the retrieval accuracy is low. How to significantly increase the efficiency of retrieval and reduce the pressure on the IO ports within a certain allowable space is an urgent problem to be solved. Summary of the invention
[0005] The present application provides a topk data query method, system, device, storage medium and electronic device, which can improve the efficiency of topk data query and reduce the IO port pressure of server nodes for a distributed computing mode with a certain allowable space.
[0006] The specific technical solutions are as follows:
[0007] In a first aspect, an embodiment of the present application provides a topk data query method, which is applied to a data processing node and includes:
[0008] Acquire a target data set from at least one distributed storage computing node, wherein the target data set includes part of the data in the at least one distributed storage computing node;
[0009] Determine a target threshold value according to the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all distributed storage computing nodes to be queried, and the values contained in the target data set;
[0010] Sending the target threshold to each of the distributed storage computing nodes respectively;
[0011] Receive the screening results sent by each of the distributed storage computing nodes, wherein when the top represents the maximum, each of the screening results includes a value greater than or equal to the target threshold value in the corresponding distributed storage computing node, and when the top represents the minimum, each of the screening results includes a value less than or equal to the target threshold value in the corresponding distributed storage computing node;
[0012] A topk data set is obtained from all the screening results, and the topk data set is sent to the server node.
[0013] In a possible implementation, determining the target threshold according to the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all distributed storage computing nodes to be queried, and the values contained in the target data set includes:
[0014] Calculate a first target value according to the data volume of the target data set, the scaling factor, the value of k, and the total data volume stored in all distributed storage computing nodes to be queried;
[0015] Filter out the first target value and the top value from the target data set, wherein when the top represents the maximum, the top value represents the maximum value, and when the top represents the minimum, the top value represents the minimum value;
[0016] When the maximum value represents a maximum value, the minimum value among the first target values is used as the target threshold;
[0017] When the maximum value represents a minimum value, the maximum value among the first target values is used as the target threshold.
[0018] In a possible implementation, obtaining the topk data sets from all screening results includes:
[0019] When the data volume of all the screening results is equal to k, or when the data volume of all the screening results is approximately k and satisfies the query number error required by the server node, all the screening results are determined as the topk data set;
[0020] When the data volume of all the screening results is greater than k, and the number of queries required by the server node must be k, the topk data sets are screened out from all the screening results.
[0021] In a possible implementation, the method further includes:
[0022] When the data volume of all the filtering results is less than k, and the number of queries required by the server node must be k, increase the scaling factor, return to execute the step of determining the target threshold based on the data volume of the target data set, the scaling factor, the value of k, the total amount of data stored in all the distributed storage computing nodes to be queried, and the numerical value contained in the target data set, until the data volume of all the most recently received filtering results is greater than or equal to k, then execute the step of obtaining the topk data sets from all the filtering results.
[0023] In a second aspect, an embodiment of the present application provides a topk data query method, which is applied to any distributed storage computing node, and the method includes:
[0024] Receive a target threshold sent by a data processing node, wherein the target threshold is determined by the data processing node according to the amount of data in the target data set, a scaling factor, a value of k, a total amount of data stored in all distributed storage computing nodes to be queried, and a value contained in the target data set, and the target data set includes part of the data in at least one distributed storage computing node;
[0025] When the top represents the maximum, a value greater than or equal to the target threshold is filtered out from multiple values stored in the database as a filtering result;
[0026] When the top value represents the minimum, a value less than or equal to the target threshold value is selected from multiple values stored in the database as a screening result;
[0027] The screening results are sent to the data processing node, so that the data processing node obtains topk data sets from all the screening results and sends the topk data sets to the server node.
[0028] In a third aspect, an embodiment of the present application provides a topk data query system, the system comprising a plurality of distributed storage computing nodes, a data processing node and a server node;
[0029] The server node is used to send the topk query task to the data processing node;
[0030] The data processing node is used to obtain a target data set from at least one distributed storage computing node, wherein the target data set includes part of the data in the at least one distributed storage computing node; determine a target threshold value according to the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all the distributed storage computing nodes to be queried, and the values contained in the target data set; and send the target threshold value to each of the distributed storage computing nodes respectively;
[0031] Each of the distributed storage computing nodes is configured to receive the target threshold; when the top represents the maximum, filter out a value greater than or equal to the target threshold from the multiple values stored in the database as a filter result; when the top represents the minimum, filter out a value less than or equal to the target threshold from the multiple values stored in the database as a filter result; and send the filter result to the data processing node;
[0032] The data processing node is further used to receive the screening results sent by each of the distributed storage computing nodes, obtain the topk data sets from all the screening results, and send the topk data sets to the server node;
[0033] The server node is used to receive the topk data set sent by the data processing node.
[0034] In a possible implementation, the data processing node is used to calculate the first target value according to the data volume of the target data set, the scaling factor, the value of k, and the total data volume stored in all distributed storage computing nodes to be queried;
[0035] Filter out the first target value and the top value from the target data set, wherein when the top represents the maximum, the top value represents the maximum value, and when the top represents the minimum, the top value represents the minimum value;
[0036] When the maximum value represents a maximum value, the minimum value among the first target values is used as the target threshold;
[0037] When the maximum value represents a minimum value, the maximum value among the first target values is used as the target threshold.
[0038] In a possible implementation, the data processing node is used to determine all the screening results as the topk data set when the data volume of all the screening results is equal to k, or when the data volume of all the screening results is approximately k and satisfies the query number error required by the server node;
[0039] When the data volume of all the screening results is greater than k, and the number of queries required by the server node must be k, the topk data sets are screened out from all the screening results.
[0040] In one possible implementation, the data processing node is used to increase the scaling factor when the data volume of all the filtering results is less than k and the number of queries required by the server node must be k, and return to execute the step of determining the target threshold based on the data volume of the target data set, the scaling factor, the value of k, the total amount of data stored in all the distributed storage computing nodes to be queried, and the numerical value contained in the target data set, until the data volume of all the most recently received filtering results is greater than or equal to k, and then execute the step of obtaining the topk data sets from all the filtering results.
[0041] In a fourth aspect, an embodiment of the present application provides a topk data query device, which is applied to a data processing node, and includes:
[0042] An acquisition unit, configured to acquire a target data set from at least one distributed storage computing node, wherein the target data set includes part of the data in the at least one distributed storage computing node;
[0043] A determination unit, configured to determine a target threshold value according to the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all distributed storage computing nodes to be queried, and the values contained in the target data set;
[0044] A sending unit, used for sending the target threshold to each of the distributed storage computing nodes respectively;
[0045] A receiving unit, configured to receive a screening result sent by each of the distributed storage computing nodes, wherein when the top represents the maximum, each of the screening results includes a value greater than or equal to the target threshold value in the corresponding distributed storage computing node, and when the top represents the minimum, each of the screening results includes a value less than or equal to the target threshold value in the corresponding distributed storage computing node;
[0046] The screening unit is used to obtain the topk data sets from all the screening results;
[0047] The sending unit is further used to send the topk data set to the server node.
[0048] In a possible implementation, the determining unit includes:
[0049] A calculation module, used to calculate a first target value according to the data volume of the target data set, the scaling factor, the value of k, and the total data volume stored in all distributed storage computing nodes to be queried;
[0050] A screening module, used for screening out a first target value and a maximum value from the target data set, wherein when the top represents the maximum, the maximum value represents the maximum value, and when the top represents the minimum, the maximum value represents the minimum value;
[0051] A determination module is used to, when the extreme value represents a maximum value, use the minimum value among the first target value extreme values as the target threshold; when the extreme value represents a minimum value, use the maximum value among the first target value extreme values as the target threshold.
[0052] In a possible implementation, the screening unit is used to determine all the screening results as the topk data set when the data volume of all the screening results is equal to k, or when the data volume of all the screening results is approximately k and satisfies the query number error required by the server node; and to screen out the topk data set from all the screening results when the data volume of all the screening results is greater than k and the query number required by the server node must be k.
[0053] In a possible implementation, the device further includes:
[0054] The adjustment unit is used to increase the scaling factor when the data volume of all the filtering results is less than k and the number of queries required by the server node must be k, and return to execute the step of determining the target threshold value based on the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all the distributed storage computing nodes to be queried, and the numerical value contained in the target data set, until the data volume of all the most recently received filtering results is greater than or equal to k, and then execute the step of obtaining the topk data sets from all the filtering results.
[0055] In a fifth aspect, an embodiment of the present application provides a topk data query device, which is applied to any distributed storage computing node, and the device includes:
[0056] a receiving unit, configured to receive a target threshold value sent by a data processing node, wherein the target threshold value is determined by the data processing node according to the data volume of a target data set, a scaling factor, a value of k, a total data volume stored in all distributed storage computing nodes to be queried, and a numerical value contained in the target data set, and the target data set includes partial data in at least one distributed storage computing node;
[0057] a screening unit, configured to, when the top represents the maximum, screen out a value greater than or equal to the target threshold from the multiple values stored in the database as a screening result; and, when the top represents the minimum, screen out a value less than or equal to the target threshold from the multiple values stored in the database as a screening result;
[0058] The sending unit is used to send the screening results to the data processing node, so that the data processing node obtains the topk data sets from all the screening results and sends the topk data sets to the server node.
[0059] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processing unit, implements the method described in any possible implementation manner of the first aspect, or, when the program is executed by a processing unit, implements the method described in the second aspect.
[0060] In a seventh aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: one or more processing units;
[0061] The processing unit is coupled to a storage unit, and the storage unit is used to store one or more programs; when the one or more programs are executed by the one or more processing units, the electronic device implements the method as described in any possible implementation manner of the first aspect;
[0062] Alternatively, the electronic device includes at least one integrated storage and computing chip, and each of the integrated storage and computing chips is used to execute the method as described in any possible implementation manner of the first aspect, or is used to execute the method according to the second aspect;
[0063] Alternatively, the electronic device includes the system described in the third aspect.
[0064] In an eighth aspect, an embodiment of the present application provides a computer program product, which includes instructions. When the instructions are executed on a computer or a processing unit, the computer or the processing unit executes the method described in any possible implementation of the first aspect, or executes the method described in the second aspect.
[0065] The topk data query method, system, device, storage medium and electronic device provided in the embodiments of the present application can not only enable the data processing node to directly upload the topk data set to the server node, so that the IO port of the server node only transmits the topk data set without transmitting redundant data, thereby greatly reducing the IO port pressure of the server node, but also when the data processing node queries the topk data set, it does not blindly obtain all data from all distributed storage computing nodes and then query the topk data set from them, but only needs to extract a small part of the data as the target data set, and according to the data volume of the target data set, the scaling factor, the value of k, and all distributed storage computing nodes to be queried, the topk data set is obtained. The target threshold is determined by the total amount of data stored in and the values contained in the target data set, so that each distributed storage computing node only needs to upload a part of the data to the data processing node according to the target threshold, and the data processing node obtains the topk data set from this part of the data. In other words, for the IO port of the data processing node, it only needs to receive the target data set and the screening results for the target threshold in sequence, and its order of magnitude is much smaller than the total amount of data of all distributed storage computing nodes. Therefore, although the data processing node is used as an intermediate node, it will not cause pressure on its IO port, and the data processing node only needs to obtain the topk data set from the target data set with a smaller amount of data, and its calculation amount is relatively small. In summary, the embodiments of the present application can not only reduce the pressure on the IO port of the server node, but also improve the efficiency of topk data query in the distributed computing mode.
[0066] In addition, the technical effects that can be achieved by the embodiments of the present application include:
[0067] 1. When calculating the target threshold, a value is not randomly selected as the target threshold. Instead, the first target value is calculated based on the data volume of the target data set, the scaling factor, the value of k, and the total amount of data stored in all distributed storage computing nodes to be queried. Then, the first target value is obtained from the target data set. Finally, the target threshold is obtained from the first target value. This makes the calculated target threshold more conducive to quickly obtaining the topk data sets.
[0068] 2. When the data volume of all filtering results is greater than k and the number of queries required by the server node must be k, the topk data sets can be filtered out from all filtering results. When the data volume of all filtering results is equal to k, or when the data volume of all filtering results is approximately k and meets the query number error required by the server node, all filtering results can be directly determined as the topk data sets without secondary screening, thereby further improving the efficiency of topk data queries.
[0069] 3. When the data volume of all filtered results is less than k, and the number of queries required by the server node must be k, the target threshold can be recalculated by increasing the scaling factor so that all the filtered results finally obtained can be used to obtain the topk data set, thereby improving the reliability of the topk data query. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art description are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative work.
[0071] Figure 1 A flowchart of a topk data query method provided in an embodiment of the present application;
[0072] Figure 2 A flowchart of another topk data query method provided in an embodiment of the present application;
[0073] Figure 3 A schematic diagram of the architecture of a topk data query system provided in an embodiment of the present application;
[0074] Figure 4 A block diagram of a topk data query device provided in an embodiment of the present application;
[0075] Figure 5 A block diagram of another topk data query device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0076] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0077] It should be noted that, in the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The terms "including" and "having" in the embodiments of the present application and the accompanying drawings and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.
[0078] In order to improve the efficiency of topk data query in distributed computing mode and reduce the IO port pressure of server nodes, the embodiment of the present application provides a topk data query method, which can be applied to data processing nodes, such as Figure 1 As shown, the method includes:
[0079] S110: Acquire a target data set from at least one distributed storage computing node.
[0080] The target data set includes part of the data in at least one distributed storage computing node.
[0081] When the data processing node receives the topk query task sent by the server node, the data processing node obtains the data extraction strategy and sends a data extraction command to the corresponding distributed storage computing node according to the data extraction strategy, so that the distributed storage computing node that receives the data extraction command extracts part of the data from its own stored data and reports it to the data processing node.
[0082] The data extraction strategies include but are not limited to the following:
[0083] (1) Each distributed storage computing node is required to randomly extract the same amount of data;
[0084] (2) Randomly extract some data from a distributed storage computing node;
[0085] (3) randomly selecting P distributed storage computing nodes from all the distributed storage computing nodes to be queried, and then randomly selecting data of the same amount from the P distributed storage computing nodes, where P is less than the number of all the distributed storage computing nodes to be queried;
[0086] (4) All distributed storage computing nodes to be queried are regarded as a whole, and data are randomly extracted from all distributed storage computing nodes to be queried through a certain random number selection mechanism until the target data set is obtained.
[0087] In addition, the data volume of the target data set may be a data volume determined empirically, for example, the data volume is one tenth of the total data volume stored in all distributed storage computing nodes to be queried.
[0088] S120: Determine a target threshold value according to the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all distributed storage computing nodes to be queried, and the values contained in the target data set.
[0089] Specifically, the data processing node can first calculate the first target value based on the data volume of the target data set, the scaling factor, the value of k, and the total data volume stored in all distributed storage computing nodes to be queried; then filter out the first target value and the top values from the target data set, where when top represents the maximum, the top value represents the maximum value, and when top represents the minimum, the top value represents the minimum value; when the top value represents the maximum value, the minimum value among the first target value and the top values is used as the target threshold; when the top value represents the minimum value, the maximum value among the first target value and the top values is used as the target threshold.
[0090] According to the data volume of the target data set, the scaling factor, the value of k, and the total data volume stored in all distributed storage computing nodes to be queried, the specific calculation formula for calculating the first target value may be:
[0091]
[0092] Among them, Q represents the first target value, X represents the scaling factor, k represents the amount of data in topk to be queried by the server node, N represents the total amount of data stored in all distributed storage computing nodes to be queried, and S represents the amount of data in the target data set.
[0093] Methods for selecting the maximum value of the first target value from the target data set include but are not limited to sorting method, max-heap method, etc.
[0094] In this step, when calculating the target threshold, a numerical value is not blindly and randomly selected as the target threshold. Instead, the first target value is calculated based on the data volume of the target data set, the scaling factor, the value of k, and the total amount of data stored in all distributed storage computing nodes to be queried. Then, the maximum value of the first target value is obtained from the target data set, and finally, the target threshold is obtained from the maximum value of the first target value, so that the calculated target threshold is more conducive to quickly obtaining the topk data sets.
[0095] S130: Send the target threshold to each distributed storage computing node respectively.
[0096] Each distributed storage computing node in this step refers to each distributed storage computing node among all distributed storage computing nodes to be queried.
[0097] All the distributed storage computing nodes to be queried may be all the distributed storage computing nodes included in the topk data query system, or may be some of the distributed storage computing nodes included in the topk data query system. For example, although the topk data query system includes 10 distributed storage computing nodes, in view of the different application scenarios, source scenarios, etc. of the data stored in different distributed storage computing nodes, the server node only wants to perform topk data queries from 8 designated distributed storage computing nodes. In this case, all the distributed storage computing nodes to be queried are the designated 8 distributed storage computing nodes, and each distributed storage computing node is each of the 8 distributed storage computing nodes.
[0098] S140: Receive the screening result sent by each distributed storage computing node.
[0099] Among them, when top represents the maximum, each filtering result includes the values in the corresponding distributed storage computing node that are greater than or equal to the target threshold; when top represents the minimum, each filtering result includes the values in the corresponding distributed storage computing node that are less than or equal to the target threshold.
[0100] S150: Obtain topk data sets from all screening results, and send the topk data sets to the server node.
[0101] When the data volume of all filtering results is equal to k, or when the data volume of all filtering results is approximately k and meets the query number error required by the server node, all filtering results can be directly determined as the topk data set without secondary filtering, thereby further improving the efficiency of topk data query; when the data volume of all filtering results is greater than k and the query number required by the server node must be k, the topk data set is filtered out from all filtering results.
[0102] When X=1 or X≈1, the number of all screening results may not be exactly equal to k, but it is very close. At this time, if the query number error required by the server node is met, all screening results can be directly determined as the topk data set and sent to the server node. When X>1, the number of all screening results is usually greater than k, and k values can be screened out from all screening results according to the screening method in the relevant technology, such as first sorting all screening results and screening out the first k values, and then sending the screened k values as the topk data set to the server node.
[0103] In one possible implementation, when the data volume of all filtering results is less than k and the number of queries required by the server node must be k, the data processing node may first increase the scaling factor, and then return to execute based on the data volume of the target data set, the scaling factor, the value of k, the total amount of data stored in all distributed storage computing nodes to be queried, and the numerical value contained in the target data set, to determine the target threshold (i.e., return to execute step S120), until the data volume of all the most recently received filtering results is greater than or equal to k, and then execute to obtain the topk data sets from all the filtering results.
[0104] The embodiment of the present application does not limit the adjustment strategy for increasing the scaling factor. For example, each adjustment may increase a fixed value based on the most recently determined scaling factor, or increase the scaling factor by a fixed multiple.
[0105] Normally, by adjusting the scaling factor once or multiple times, the data volume of all screening results can be made greater than or equal to k. However, if you encounter rare special circumstances, such as: in the process of increasing the scaling factor, if the latest calculated first target value is greater than the data volume of the target data set, resulting in the inability to determine the target threshold based on the first target value and the data volume of the target data set, you can redetermine the target data set by increasing the target data set, such as extracting a portion of data from at least one distributed storage computing node on the basis of the original target data set and adding it to the original target data set, or directly extracting data with a larger data volume than the original target data set from at least one distributed storage computing node as a new target data set, and after redetermining the target data set, re-execute S110-S150. Among them, when re-executing S110-S150, the scaling factor used can be the initial scaling factor, or it can be the scaling factor when the latest calculated first target value is greater than the data volume of the target data set.
[0106] From the above scheme, it can be seen that when the data volume of all filtering results is less than k and the number of queries required by the server node must be k, the target threshold can be recalculated by increasing the scaling factor so that all the final filtering results can be used to obtain the topk data set, thereby improving the reliability of the topk data query.
[0107] It should be added that the physical entity conditions of each node involved in the embodiment of the present application and the following embodiments include but are not limited to the following:
[0108] (1) All distributed storage computing nodes, data processing nodes, and server nodes are deployed in the same physical device. Each distributed storage computing node can be a storage-computing integrated chip, such as a memristor storage-computing integrated chip, or other physical entities. The data processing node is a functional module that has a communication connection with each distributed storage computing node, and the server node can be a central processing unit.
[0109] (2) Each distributed storage computing node, data processing node, and server node are deployed in independent physical devices. For example, the distributed storage computing node can be a terminal device, the data processing node can be a relay device, and the server node can be a cloud server.
[0110] (3) All distributed storage computing nodes are deployed in the same physical device. All distributed storage computing nodes are considered as a whole. All distributed storage computing nodes, data processing nodes, and server nodes are deployed in independent physical devices.
[0111] (4) All distributed storage computing nodes and data processing nodes are deployed in the same physical device, but are independent of the server nodes.
[0112] In addition, the embodiments of the present application and the following embodiments can be applied to any field that requires topk queries, such as large model reasoning, data retrieval, vector retrieval, etc. In the field of vector retrieval, it is necessary to screen out K data that are consistent with or most similar to the target demand vector. The Euclidean distance calculation can be performed on the target demand vector and the original vector calculated in all distributed storage computing nodes, and the Euclidean distance corresponding to each original vector can be recorded in the corresponding distributed storage computing node. The task of vector retrieval is converted into a task of topk distance query, that is, a task of querying the k largest Euclidean distances, and then by executing steps S110-S150, the topk data set about the Euclidean distance is obtained, and then the original vector corresponding to each Euclidean distance is searched to obtain the topk data set about the vector, and finally the topk data set about the vector is sent to the server node.
[0113] The topk data query method provided in the embodiment of the present application can not only enable the data processing node to directly upload the topk data set to the server node, so that the IO port of the server node only transmits the topk data set without transmitting redundant data, thereby greatly reducing the IO port pressure of the server node, but also when the data processing node queries the topk data set, it does not blindly obtain all data from all distributed storage computing nodes and then query the topk data set from them, but only needs to extract a small part of the data as the target data set, and according to the data volume of the target data set, the scaling factor, the value of k, and the total amount of data stored in all distributed storage computing nodes to be queried, And the values contained in the target data set, determine the target threshold, so that each distributed storage computing node only needs to upload a part of the data to the data processing node according to the target threshold, and the data processing node obtains the topk data set from this part of the data, that is, for the IO port of the data processing node, it only needs to receive the target data set and the screening results for the target threshold in sequence, and its order of magnitude is much smaller than the total data volume of all distributed storage computing nodes. Therefore, although the data processing node is used as an intermediate node, it will not cause pressure on its IO port, and the data processing node only needs to obtain the topk data set from the target data set with a smaller data volume, and its calculation amount is relatively small. In summary, the embodiment of the present application can not only reduce the IO port pressure of the server node, but also improve the efficiency of topk data query in the distributed computing mode.
[0114] Based on the above method embodiment, another embodiment of the present application provides a topk data query method, which can be applied to any distributed storage computing node, such as Figure 2 As shown, the method includes:
[0115] S210: Receive a target threshold sent by a data processing node.
[0116] Among them, the target threshold is determined by the data processing node based on the data volume of the target data set, the scaling factor, the value of k, the total amount of data stored in all distributed storage computing nodes to be queried, and the numerical value contained in the target data set. The target data set includes partial data in at least one distributed storage computing node.
[0117] When the data processing node receives the topk query task sent by the server node, the data processing node obtains the data extraction strategy and sends the data extraction command to the corresponding distributed storage computing node according to the data extraction strategy, so that the distributed storage computing node that receives the data extraction command extracts part of the data from its own stored data and reports it to the data processing node. After the data processing node obtains the target data set based on the reported data, it can determine the target threshold according to the data volume of the target data set, the scaling factor, the value of k, the total amount of data stored in all distributed storage computing nodes to be queried, and the values contained in the target data set, and send the target threshold to each distributed storage computing node.
[0118] Among them, the specific implementation method of the data processing node calculating the target threshold includes: firstly, calculating the first target value according to the data volume of the target data set, the scaling factor, the value of k and the total data volume stored in all distributed storage computing nodes to be queried; then, filtering out the first target value and the top values from the target data set, wherein, when top represents the maximum, the top value represents the maximum value, and when top represents the minimum, the top value represents the minimum value; when the top value represents the maximum value, the minimum value among the first target value and the top values is taken as the target threshold; when the top value represents the minimum value, the maximum value among the first target value and the top values is taken as the target threshold.
[0119] According to the data volume of the target data set, the scaling factor, the value of k, and the total data volume stored in all distributed storage computing nodes to be queried, the specific calculation formula for calculating the first target value may be:
[0120]
[0121] Among them, Q represents the first target value, X represents the scaling factor, k represents the amount of data in topk to be queried by the server node, N represents the total amount of data, and S represents the amount of data in the target data set.
[0122] Methods for selecting the first target value and the maximum value from the target data set include sorting method, max-heap method, etc.
[0123] S220: When top indicates the maximum, a value greater than or equal to a target threshold is filtered out from a plurality of values stored in the database as a filtering result.
[0124] When top means the maximum, topk means obtaining the largest k values from N values. Therefore, the distributed storage computing node can first use the target threshold as the critical value, and filter out values greater than or equal to the target threshold from its own database as the filtering results, so that the data processing node can obtain the topk data set according to the filtering results.
[0125] S230: When top indicates the minimum, a value that is less than or equal to the target threshold is filtered out from the multiple values stored in the database as a filtering result.
[0126] When top means minimum, topk means obtaining the smallest k values from N values. Therefore, the distributed storage computing node can first use the target threshold as the critical value, and filter out values less than or equal to the target threshold from its own database as the filtering results, so that the data processing node can obtain the topk data set according to the filtering results.
[0127] S240: Send the screening results to the data processing node, so that the data processing node obtains the topk data sets from all the screening results and sends the topk data sets to the server node.
[0128] After the distributed storage computing node obtains the screening results, it can send the screening results to the data processing node, so that after the data processing node obtains all the screening results, it can obtain the topk data sets from all the screening results and send them to the server node. The specific implementation method of obtaining the topk data sets from all the screening results can be referred to the detailed explanation of step S150, which will not be repeated here.
[0129] The topk data query method provided in the embodiment of the present application can not only enable the data processing node to directly upload the topk data set to the server node, so that the IO port of the server node only transmits the topk data set without transmitting redundant data, thereby greatly reducing the IO port pressure of the server node, but also when the data processing node queries the topk data set, it does not blindly obtain all data from all distributed storage computing nodes and then query the topk data set from them, but only needs to extract a small part of the data as the target data set, and according to the data volume of the target data set, the scaling factor, the value of k, and the total amount of data stored in all distributed storage computing nodes to be queried, And the values contained in the target data set, determine the target threshold, so that each distributed storage computing node only needs to upload a part of the data to the data processing node according to the target threshold, and the data processing node obtains the topk data set from this part of the data, that is, for the IO port of the data processing node, it only needs to receive the target data set and the screening results for the target threshold in sequence, and its order of magnitude is much smaller than the total data volume of all distributed storage computing nodes. Therefore, although the data processing node is used as an intermediate node, it will not cause pressure on its IO port, and the data processing node only needs to obtain the topk data set from the target data set with a smaller data volume, and its calculation amount is relatively small. In summary, the embodiment of the present application can not only reduce the IO port pressure of the server node, but also improve the efficiency of topk data query in the distributed computing mode.
[0130] Based on the above method embodiment, another embodiment of the present application provides a topk data query system, such as Figure 3 As shown, the system includes a plurality of distributed storage computing nodes 310, a data processing node 320 and a server node 330;
[0131] The server node 330 is used to send the topk query task to the data processing node 320;
[0132] The data processing node 320 is used to obtain a target data set from at least one distributed storage computing node 310, wherein the target data set includes part of the data in the at least one distributed storage computing node 310; determine a target threshold value according to the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all the distributed storage computing nodes 310 to be queried, and the value contained in the target data set; and send the target threshold value to each of the distributed storage computing nodes 310 respectively;
[0133] Each of the distributed storage computing nodes 310 is configured to receive the target threshold; when the top represents the maximum, filter out a value greater than or equal to the target threshold from the multiple values stored in the database as a filter result; when the top represents the minimum, filter out a value less than or equal to the target threshold from the multiple values stored in the database as a filter result; and send the filter result to the data processing node 320;
[0134] The data processing node 320 is further used to receive the screening results sent by each of the distributed storage computing nodes 310, obtain the topk data sets from all the screening results, and send the topk data sets to the server node 330;
[0135] The server node 330 is used to receive the topk data set sent by the data processing node 320 .
[0136] In a possible implementation, the data processing node 320 is used to calculate the first target value according to the data volume of the target data set, the scaling factor, the value of k, and the total data volume stored in all the distributed storage computing nodes 310 to be queried;
[0137] Filter out the first target value and the top value from the target data set, wherein when the top represents the maximum, the top value represents the maximum value, and when the top represents the minimum, the top value represents the minimum value;
[0138] When the maximum value represents a maximum value, the minimum value among the first target values is used as the target threshold;
[0139] When the maximum value represents a minimum value, the maximum value among the first target values is used as the target threshold.
[0140] In a possible implementation manner, the data processing node 320 is configured to determine all the screening results as the topk data set when the data volume of all the screening results is equal to k, or when the data volume of all the screening results is approximately k and satisfies the query number error required by the server node 330;
[0141] When the data volume of all the screening results is greater than k, and the number of queries required by the server node 330 must be k, the topk data sets are screened out from all the screening results.
[0142] In one possible implementation, the data processing node 320 is used to increase the scaling factor when the data volume of all the filtering results is less than k and the number of queries required by the server node 330 must be k, and return to execute the step of determining the target threshold based on the data volume of the target data set, the scaling factor, the value of k, the total amount of data stored in all the distributed storage computing nodes 310 to be queried, and the numerical value contained in the target data set, until the data volume of all the most recently received filtering results is greater than or equal to k, and then execute the step of obtaining the topk data sets from all the filtering results.
[0143] The topk data query system provided by the embodiment of the present application can not only upload the topk data set directly to the server node by the data processing node, so that the IO port of the server node only transmits the topk data set without transmitting redundant data, thereby greatly reducing the IO port pressure of the server node, but also when the data processing node queries the topk data set, it does not blindly obtain all data from all distributed storage computing nodes and then query the topk data set from them, but only needs to extract a small part of the data as the target data set, and according to the data volume of the target data set, the scaling factor, the value of k, and the total amount of data stored in all distributed storage computing nodes to be queried, And the values contained in the target data set, determine the target threshold, so that each distributed storage computing node only needs to upload a part of the data to the data processing node according to the target threshold, and the data processing node obtains the topk data set from this part of the data, that is, for the IO port of the data processing node, it only needs to receive the target data set and the screening results for the target threshold in sequence, and its order of magnitude is much smaller than the total data volume of all distributed storage computing nodes. Therefore, although the data processing node is used as an intermediate node, it will not cause pressure on its IO port, and the data processing node only needs to obtain the topk data set from the target data set with a smaller data volume, and its calculation amount is relatively small. In summary, the embodiment of the present application can not only reduce the IO port pressure of the server node, but also improve the efficiency of topk data query in the distributed computing mode.
[0144] Based on the above method embodiment, another embodiment of the present application provides a topk data query device, such as Figure 4 As shown, the device comprises:
[0145] An acquisition unit 410 is configured to acquire a target data set from at least one distributed storage computing node, wherein the target data set includes part of the data in the at least one distributed storage computing node;
[0146] A determination unit 420, configured to determine a target threshold value according to the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all distributed storage computing nodes to be queried, and the values contained in the target data set;
[0147] A sending unit 430, configured to send the target threshold to each of the distributed storage computing nodes respectively;
[0148] A receiving unit 440 is used to receive the screening results sent by each of the distributed storage computing nodes, wherein when the top represents the maximum, each of the screening results includes a value greater than or equal to the target threshold value in the corresponding distributed storage computing node, and when the top represents the minimum, each of the screening results includes a value less than or equal to the target threshold value in the corresponding distributed storage computing node;
[0149] A screening unit 450, configured to obtain a topk data set from all screening results;
[0150] The sending unit 430 is further configured to send the topk data set to a server node.
[0151] In a possible implementation manner, the determining unit 420 includes:
[0152] A calculation module, used to calculate a first target value according to the data volume of the target data set, the scaling factor, the value of k, and the total data volume stored in all distributed storage computing nodes to be queried;
[0153] A screening module, used for screening out a first target value and a maximum value from the target data set, wherein when the top represents the maximum, the maximum value represents the maximum value, and when the top represents the minimum, the maximum value represents the minimum value;
[0154] A determination module is used to, when the extreme value represents a maximum value, use the minimum value among the first target value extreme values as the target threshold; when the extreme value represents a minimum value, use the maximum value among the first target value extreme values as the target threshold.
[0155] In a possible implementation, the screening unit 450 is used to determine all the screening results as the topk data set when the data volume of all the screening results is equal to k, or when the data volume of all the screening results is approximately k and satisfies the query number error required by the server node; when the data volume of all the screening results is greater than k and the query number required by the server node must be k, screen out the topk data set from all the screening results.
[0156] In a possible implementation, the device further includes:
[0157] The adjustment unit is used to increase the scaling factor when the data volume of all the filtering results is less than k and the number of queries required by the server node must be k, and return to execute the step of determining the target threshold value based on the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all the distributed storage computing nodes to be queried, and the numerical value contained in the target data set, until the data volume of all the most recently received filtering results is greater than or equal to k, and then execute the step of obtaining the topk data sets from all the filtering results.
[0158] The topk data query device provided in the embodiment of the present application can not only upload the topk data set directly to the server node by the data processing node, so that the IO port of the server node only transmits the topk data set without transmitting redundant data, thereby greatly reducing the IO port pressure of the server node, but also when the data processing node queries the topk data set, it does not blindly obtain all data from all distributed storage computing nodes and then query the topk data set from them, but only needs to extract a small part of the data as the target data set, and according to the data volume of the target data set, the scaling factor, the value of k, and the total amount of data stored in all distributed storage computing nodes to be queried, And the values contained in the target data set, determine the target threshold, so that each distributed storage computing node only needs to upload a part of the data to the data processing node according to the target threshold, and the data processing node obtains the topk data set from this part of the data, that is, for the IO port of the data processing node, it only needs to receive the target data set and the screening results for the target threshold in sequence, and its order of magnitude is much smaller than the total data volume of all distributed storage computing nodes. Therefore, although the data processing node is used as an intermediate node, it will not cause pressure on its IO port, and the data processing node only needs to obtain the topk data set from the target data set with a smaller data volume, and its calculation amount is relatively small. In summary, the embodiment of the present application can not only reduce the IO port pressure of the server node, but also improve the efficiency of topk data query in the distributed computing mode.
[0159] Based on the above method embodiment, another embodiment of the present application provides a topk data query device, such as Figure 5 As shown, the device is applied to any distributed storage computing node, and the device includes:
[0160] A receiving unit 510 is used to receive a target threshold sent by a data processing node, wherein the target threshold is determined by the data processing node according to the data volume of a target data set, a scaling factor, a value of k, a total amount of data stored in all distributed storage computing nodes to be queried, and a value contained in the target data set, and the target data set includes partial data in at least one distributed storage computing node;
[0161] A screening unit 520, configured to, when the top represents the maximum, screen out a value greater than or equal to the target threshold from the multiple values stored in the database as a screening result; when the top represents the minimum, screen out a value less than or equal to the target threshold from the multiple values stored in the database as a screening result;
[0162] The sending unit 530 is used to send the screening results to the data processing node, so that the data processing node obtains the topk data sets from all the screening results and sends the topk data sets to the server node.
[0163] The topk data query device provided in the embodiment of the present application can not only upload the topk data set directly to the server node by the data processing node, so that the IO port of the server node only transmits the topk data set without transmitting redundant data, thereby greatly reducing the IO port pressure of the server node, but also when the data processing node queries the topk data set, it does not blindly obtain all data from all distributed storage computing nodes and then query the topk data set from them, but only needs to extract a small part of the data as the target data set, and according to the data volume of the target data set, the scaling factor, the value of k, and the total amount of data stored in all distributed storage computing nodes to be queried, And the values contained in the target data set, determine the target threshold, so that each distributed storage computing node only needs to upload a part of the data to the data processing node according to the target threshold, and the data processing node obtains the topk data set from this part of the data, that is, for the IO port of the data processing node, it only needs to receive the target data set and the screening results for the target threshold in sequence, and its order of magnitude is much smaller than the total data volume of all distributed storage computing nodes. Therefore, although the data processing node is used as an intermediate node, it will not cause pressure on its IO port, and the data processing node only needs to obtain the topk data set from the target data set with a smaller data volume, and its calculation amount is relatively small. In summary, the embodiment of the present application can not only reduce the IO port pressure of the server node, but also improve the efficiency of topk data query in the distributed computing mode.
[0164] Based on the above method embodiments, another embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processing unit, the method described in any of the above embodiments is implemented.
[0165] Based on the above method embodiment, another embodiment of the present application provides an electronic device, the electronic device comprising: one or more processing units; the processing unit is coupled to a storage unit, the storage unit is used to store one or more programs; when the one or more programs are executed by the one or more processing units, the electronic device implements the method described in any possible implementation of the topk data query method executed by the data processing node side;
[0166] Alternatively, the electronic device includes at least one storage-computing integrated chip, each of which is used to execute the method described in any possible implementation of the topk data query method executed by the data processing node side, or is used to execute the method described in any possible implementation of the topk data query method executed by the distributed storage computing node side;
[0167] Alternatively, the electronic device includes the system described in any of the above possible implementations.
[0168] Based on the above embodiments, another embodiment of the present application provides a computer program product, which includes instructions. When the instructions are executed on a computer or a processing unit, the computer or the processing unit executes the method described in any of the above embodiments.
[0169] The above device embodiment corresponds to the method embodiment and has the same technical effect as the method embodiment. For specific description, please refer to the method embodiment. The device embodiment is obtained based on the method embodiment. For specific description, please refer to the method embodiment part, which will not be repeated here. It can be understood by those skilled in the art that the accompanying drawings are only schematic diagrams of one embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present application.
[0170] Those skilled in the art can understand that the modules in the device in the embodiment can be distributed in the device in the embodiment according to the description of the embodiment, or can be changed accordingly and located in one or more devices different from the embodiment. The modules in the above embodiment can be combined into one module, or can be further divided into multiple sub-modules.
[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A topk data query method, characterized in that: The method is applied to a data processing node, and the method comprises: Acquire a target data set from at least one distributed storage computing node, wherein the target data set includes part of the data in the at least one distributed storage computing node; Determine a target threshold value according to the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all distributed storage computing nodes to be queried, and the values contained in the target data set; Sending the target threshold to each of the distributed storage computing nodes respectively; Receive the screening results sent by each of the distributed storage computing nodes, wherein when the top represents the maximum, each of the screening results includes a value greater than or equal to the target threshold value in the corresponding distributed storage computing node, and when the top represents the minimum, each of the screening results includes a value less than or equal to the target threshold value in the corresponding distributed storage computing node; Obtaining topk data sets from all screening results, and sending the topk data sets to the server node; Determining the target threshold according to the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all distributed storage computing nodes to be queried, and the values contained in the target data set includes: A first target value is calculated according to the data volume of the target data set, the scaling factor, the value of k, and the total data volume stored in all distributed storage computing nodes to be queried. The calculation formula of the first target value is: Wherein, Q represents the first target value, X represents the scaling factor, k represents the amount of data in topk to be queried by the server node, N represents the total amount of data stored in all distributed storage computing nodes to be queried, and S represents the amount of data in the target data set; Filter out the first target value and the top value from the target data set, wherein when the top represents the maximum, the top value represents the maximum value, and when the top represents the minimum, the top value represents the minimum value; When the maximum value represents a maximum value, the minimum value among the first target values is used as the target threshold; When the maximum value represents a minimum value, the maximum value among the first target values is used as the target threshold.
2. The method according to claim 1, characterized in that The topk data sets are obtained from all screening results, including: When the data volume of all the screening results is equal to k, or when the data volume of all the screening results is approximately k and satisfies the query number error required by the server node, all the screening results are determined as the topk data set; When the data volume of all the screening results is greater than k, and the number of queries required by the server node must be k, the topk data sets are screened out from all the screening results.
3. The method according to any one of claims 1 to 2, characterized in that: The method further comprises: When the data volume of all the filtering results is less than k, and the number of queries required by the server node must be k, increase the scaling factor, return to execute the step of determining the target threshold based on the data volume of the target data set, the scaling factor, the value of k, the total amount of data stored in all the distributed storage computing nodes to be queried, and the numerical value contained in the target data set, until the data volume of all the most recently received filtering results is greater than or equal to k, then execute the step of obtaining the topk data sets from all the filtering results.
4. A topk data query method, characterized in that: The method is applied to any distributed storage computing node, and the method includes: Receive a target threshold sent by a data processing node, wherein the target threshold is determined by the data processing node according to the data volume of the target data set, the scaling factor, the value of k, the total amount of data stored in all distributed storage computing nodes to be queried, and the numerical value contained in the target data set, and the target data set includes partial data in at least one distributed storage computing node; the method for determining the target threshold comprises: calculating a first target value according to the data volume of the target data set, the scaling factor, the value of k, and the total amount of data stored in all distributed storage computing nodes to be queried, and the calculation formula of the first target value is Wherein, Q represents the first target value, X represents the scaling factor, k represents the amount of data in k of topk to be queried by the server node, N represents the total amount of data stored in all distributed storage computing nodes to be queried, and S represents the amount of data in the target data set; the first target value maximum value is screened out from the target data set, wherein when top represents the maximum, the maximum value represents the maximum value, and when top represents the minimum, the maximum value represents the minimum value; when the maximum value represents the maximum value, the minimum value among the first target value maximum values is used as the target threshold; when the maximum value represents the minimum value, the maximum value among the first target value maximum values is used as the target threshold; When the top represents the maximum, a value greater than or equal to the target threshold is filtered out from multiple values stored in the database as a filtering result; When the top value represents the minimum, a value less than or equal to the target threshold value is selected from multiple values stored in the database as a screening result; The screening results are sent to the data processing node, so that the data processing node obtains topk data sets from all the screening results and sends the topk data sets to the server node.
5. A topk data query system, characterized in that: The system includes a plurality of distributed storage computing nodes, data processing nodes and server nodes; The server node is used to send the topk query task to the data processing node; The data processing node is used to obtain a target data set from at least one distributed storage computing node, wherein the target data set includes part of the data in the at least one distributed storage computing node; determine a target threshold value according to the data volume of the target data set, a scaling factor, a value of k, the total data volume stored in all the distributed storage computing nodes to be queried, and the numerical value contained in the target data set; and send the target threshold value to each of the distributed storage computing nodes respectively; wherein, determining the target threshold value according to the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all the distributed storage computing nodes to be queried, and the numerical value contained in the target data set includes: calculating a first target value according to the data volume of the target data set, the scaling factor, the value of k, and the total data volume stored in all the distributed storage computing nodes to be queried, and the calculation formula of the first target value is: Wherein, Q represents the first target value, X represents the scaling factor, k represents the amount of data in k of topk to be queried by the server node, N represents the total amount of data stored in all distributed storage computing nodes to be queried, and S represents the amount of data in the target data set; the first target value maximum value is screened out from the target data set, wherein when top represents the maximum, the maximum value represents the maximum value, and when top represents the minimum, the maximum value represents the minimum value; when the maximum value represents the maximum value, the minimum value among the first target value maximum values is used as the target threshold; when the maximum value represents the minimum value, the maximum value among the first target value maximum values is used as the target threshold; Each of the distributed storage computing nodes is configured to receive the target threshold; when the top represents the maximum, filter out a value greater than or equal to the target threshold from the multiple values stored in the database as a filter result; when the top represents the minimum, filter out a value less than or equal to the target threshold from the multiple values stored in the database as a filter result; and send the filter result to the data processing node; The data processing node is further used to receive the screening results sent by each of the distributed storage computing nodes, obtain the topk data sets from all the screening results, and send the topk data sets to the server node; The server node is used to receive the topk data set sent by the data processing node.
6. A topk data query device, characterized in that: The device is applied to a data processing node, and comprises: An acquisition unit, configured to acquire a target data set from at least one distributed storage computing node, wherein the target data set includes part of the data in the at least one distributed storage computing node; A determination unit, configured to determine a target threshold value according to the data volume of the target data set, the scaling factor, the value of k, the total data volume stored in all distributed storage computing nodes to be queried, and the values contained in the target data set; A sending unit, used to send the target threshold to each of the distributed storage computing nodes respectively; A receiving unit, configured to receive a screening result sent by each of the distributed storage computing nodes, wherein when the top represents the maximum, each of the screening results includes a value greater than or equal to the target threshold value in the corresponding distributed storage computing node, and when the top represents the minimum, each of the screening results includes a value less than or equal to the target threshold value in the corresponding distributed storage computing node; The screening unit is used to obtain the topk data sets from all the screening results; The sending unit is further used to send the topk data set to the server node; The determining unit comprises: A calculation module is used to calculate a first target value according to the data volume of the target data set, the scaling factor, the value of k and the total data volume stored in all distributed storage computing nodes to be queried. The calculation formula of the first target value is: Wherein, Q represents the first target value, X represents the scaling factor, k represents the amount of data in topk to be queried by the server node, N represents the total amount of data stored in all distributed storage computing nodes to be queried, and S represents the amount of data in the target data set; A screening module, used for screening out a first target value and a maximum value from the target data set, wherein when the top represents the maximum, the maximum value represents the maximum value, and when the top represents the minimum, the maximum value represents the minimum value; A determination module is used to, when the extreme value represents a maximum value, use the minimum value among the first target value extreme values as the target threshold; when the extreme value represents a minimum value, use the maximum value among the first target value extreme values as the target threshold.
7. A topk data query device, characterized in that: The device is applied to any distributed storage computing node, and the device includes: A receiving unit is used to receive a target threshold sent by a data processing node, wherein the target threshold is determined by the data processing node according to the data volume of the target data set, the scaling factor, the value of k, the total amount of data stored in all distributed storage computing nodes to be queried, and the numerical value contained in the target data set, and the target data set includes part of the data in at least one distributed storage computing node. The method for determining the target threshold includes: calculating a first target value according to the data volume of the target data set, the scaling factor, the value of k, and the total amount of data stored in all distributed storage computing nodes to be queried, and the calculation formula of the first target value is: Wherein, Q represents the first target value, X represents the scaling factor, k represents the amount of data in k of topk to be queried by the server node, N represents the total amount of data stored in all distributed storage computing nodes to be queried, and S represents the amount of data in the target data set; the first target value maximum value is screened out from the target data set, wherein when top represents the maximum, the maximum value represents the maximum value, and when top represents the minimum, the maximum value represents the minimum value; when the maximum value represents the maximum value, the minimum value among the first target value maximum values is used as the target threshold; when the maximum value represents the minimum value, the maximum value among the first target value maximum values is used as the target threshold; a screening unit, configured to, when the top represents the maximum, screen out a value greater than or equal to the target threshold from the multiple values stored in the database as a screening result; and, when the top represents the minimum, screen out a value less than or equal to the target threshold from the multiple values stored in the database as a screening result; The sending unit is used to send the screening results to the data processing node, so that the data processing node obtains the topk data sets from all the screening results and sends the topk data sets to the server node.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processing unit, the method according to any one of claims 1 to 3 is implemented, or when the program is executed by a processing unit, the method according to claim 4 is implemented.
9. An electronic device, characterized in that: The electronic device comprises: one or more processing units; the processing units are coupled to a storage unit, the storage unit is used to store one or more programs; when the one or more programs are executed by the one or more processing units, the electronic device implements the method according to any one of claims 1 to 3; Alternatively, the electronic device includes at least one integrated storage and computing chip, and each of the integrated storage and computing chips is used to execute the method according to any one of claims 1 to 4; Alternatively, the electronic device includes the system according to claim 5.
