A data query method and device, computer equipment and a storage medium

By working collaboratively between the client and server, using a unified query identifier to generate and update the sorted results of the tables one by one, the problem of timeout and data loss when querying large amounts of data is solved, and efficient data retrieval and querying is achieved.

CN114547057BActive Publication Date: 2025-11-18BEIJING HENGAN JIAXIN SAFETY TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210150359.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-18
Publication Date
2025-11-18
Estimated Expiration
2042-02-18

AI Technical Summary

Technical Problem

In existing technologies, when querying large amounts of data from a browser to a server, the server's table partitioning query can lead to timeouts or data loss.

Method used

By working together between the client and server, data retrieval requests are sent one after another using a unified query identifier, table-sorting results are generated one after another, and the aggregated sorting results are updated to finally obtain the target sorting result.

Benefits of technology

It reduces network traffic consumption, lowers service costs, reduces the pressure on clients to process data, and improves the efficiency of data retrieval and querying.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114547057B_ABST
    Figure CN114547057B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a data query method and device, computer equipment and a storage medium. Wherein, a statistical ranking request input by a user is acquired; the statistical ranking request is sent to a server, and a uniform query identifier and a number of sub-tables for retrieval feedback by the server are received; data retrieval requests matching the number of sub-tables are sent to the server one by one to instruct the server to generate sub-table ranking results corresponding to each sub-table one by one and update a summary ranking result; when it is determined that the sending of all data retrieval requests is completed, a ranking result acquisition request is sent to the server to instruct the server to acquire a target ranking result matching a required ranking number in the currently updated summary ranking result; and the target ranking result feedback by the server is received. Embodiments of the present application solve the problem of timeout caused by large amount of data processing when a user ranks and counts sub-tables in a cycle, reduce the occupation of network traffic, and reduce service costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data query method, apparatus, computer equipment and storage medium. Background Technology

[0002] With the continuous progress of the times, science and technology are also constantly developing. Browsers need to frequently request data from servers, and need to perform data queries and statistical rankings between browsers and servers. Therefore, the amount of data that needs to be accessed can sometimes be in the tens of thousands.

[0003] During the invention process, the inventor discovered the following shortcomings in the existing technology: Currently, when data is queried and ranked from a browser to a server, the server often partitions the data into tables when the data volume is very large. When the browser program performs statistical ranking queries on the partitioned database, it often times out and causes the query to fail if it performs statistical ranking on all partitioned tables at once; if it performs statistical ranking on the partitioned tables in a loop, the statistical data will be lost. Summary of the Invention

[0004] This invention provides a data query method, apparatus, computer equipment, and storage medium that can reduce network traffic consumption and lower service costs.

[0005] In a first aspect, embodiments of the present invention provide a data query method, executed by a client, comprising:

[0006] Obtain a statistical sorting request input by the user, the statistical sorting request including sorting conditions and the required number of rankings;

[0007] The statistical sorting request is sent to the server, and the server sends back a unified query identifier and the number of shards to be retrieved, wherein there are multiple shards.

[0008] Based on the unified query identifier, data retrieval requests matching the number of sub-tables are sent to the server one by one to instruct the server to generate sub-table sorting results corresponding to each sub-table and update the aggregate sorting results.

[0009] Upon confirming the completion of sending all the data retrieval requests, a sorting result retrieval request is sent to the server based on the unified query identifier, instructing the server to retrieve the target sorting result matching the required number of rankings from the currently updated aggregated sorting results.

[0010] Receive the target sorting result fed back by the server.

[0011] Secondly, embodiments of the present invention provide a data query method, executed by a server, comprising:

[0012] Receive a statistical sorting request sent by the client, and extract the sorting criteria and the required number of rankings from the statistical sorting request;

[0013] Based on the sorting criteria, determine the number of sub-tables corresponding to the retrieval sub-tables, and generate a unified query identifier that matches the statistical sorting request;

[0014] The number of table partitions and the unified query identifier are fed back to the client, and the unified query identifier, the sorting conditions, and the required number of rankings are stored together.

[0015] Based on the data retrieval requests sent sequentially by the client according to the unified query identifier, which match the number of sub-tables, the sub-table sorting results corresponding to each sub-table are generated sequentially according to the sorting conditions, and the summary sorting results are updated.

[0016] Based on the sorting result retrieval request sent by the client, the target sorting result matching the required number of rankings is retrieved from the currently updated aggregated sorting results and fed back to the client.

[0017] Thirdly, embodiments of the present invention also provide a data query device, executed by a client, wherein the data query device includes:

[0018] The statistical sorting request acquisition module is used to acquire the statistical sorting request input by the user, wherein the statistical sorting request includes sorting conditions and the required number of rankings;

[0019] The module for receiving the unified query identifier and the number of retrieval tables is used to send the statistical sorting request to the server and receive the unified query identifier and the number of retrieval tables from the server, wherein the number of retrieval tables is multiple.

[0020] The table sorting result generation module is used to send data retrieval requests matching the number of tables to the server one by one according to the unified query identifier, so as to instruct the server to generate the table sorting result corresponding to each table one by one and update the summary sorting result.

[0021] The target ranking result acquisition module is used to send a ranking result acquisition request to the server according to the unified query identifier when it is determined that the sending of all the data retrieval requests has been completed, so as to instruct the server to acquire the target ranking result that matches the required number of rankings in the currently updated summary ranking result;

[0022] The target sorting result receiving module is used to receive the target sorting result fed back by the server.

[0023] Fourthly, embodiments of the present invention also provide a data query device, executed by a server, wherein the data query device includes:

[0024] The statistical sorting request receiving module is used to receive statistical sorting requests sent by the client and extract sorting conditions and the required number of rankings from the statistical sorting requests;

[0025] The unified query identifier generation module is used to determine the number of sub-tables corresponding to the retrieval sub-tables based on the sorting conditions, and generate a unified query identifier that matches the statistical sorting request.

[0026] The associated storage module is used to feed back the number of table partitions and the unified query identifier to the client, and to associate and store the unified query identifier, the sorting conditions, and the required number of rankings.

[0027] The summary sorting result update module is used to generate the sub-table sorting result corresponding to each sub-table in turn according to the sorting conditions based on the data retrieval requests sent by the client in turn according to the unified query identifier and matching the number of sub-tables, and update the summary sorting result.

[0028] The target sorting result feedback module is used to retrieve the target sorting result that matches the required number of rankings from the currently updated aggregated sorting results and feed it back to the client based on the sorting result retrieval request sent by the client.

[0029] Fifthly, embodiments of the present invention also provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the data query method as described in any embodiment of the present invention.

[0030] In a sixth aspect, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the data query method as described in any embodiment of the present invention.

[0031] The technical solution provided by this invention involves: acquiring a statistical sorting request input by a user; sending the statistical sorting request to a server and receiving a unified query identifier and the number of sub-tables to be retrieved from the server; sending data retrieval requests matching the number of sub-tables to the server sequentially based on the unified query identifier, instructing the server to generate sub-table sorting results corresponding to each sub-table sequentially and update the aggregated sorting results; upon determining that all data retrieval requests have been sent, sending a sorting result retrieval request to the server based on the unified query identifier, instructing the server to retrieve a target sorting result matching the required number of rankings from the currently updated aggregated sorting results; and receiving the target sorting result from the server. This solves the problem of timeouts caused by large amounts of data processing when users perform cyclical ranking statistics on sub-tables, reduces network traffic consumption, lowers service costs, reduces the pressure on client data processing, and thus improves the efficiency of data retrieval and querying. Attached Figure Description

[0032] Figure 1 This is a flowchart of a data query method provided in Embodiment 1 of the present invention;

[0033] Figure 2 This is a flowchart of another data query method provided in Embodiment 2 of the present invention;

[0034] Figure 3 This is a schematic diagram of the structure of a data query device provided in Embodiment 3 of the present invention;

[0035] Figure 4 This is a schematic diagram of another data query device provided in Embodiment 4 of the present invention;

[0036] Figure 5 This is a schematic diagram of the structure of a computer device provided in Embodiment 5 of the present invention. Detailed Implementation

[0037] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it.

[0038] It should also be noted that, for ease of description, the accompanying drawings show only the parts relevant to the invention and not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations (or steps) as sequential processes, many of the operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but it may also have additional steps not included in the drawings. The process may correspond to a method, function, procedure, subroutine, subprogram, etc.

[0039] The terms "first" and "second," etc., used in the specification, claims, and drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units may include steps or units not listed, but rather steps or units not listed.

[0040] Example 1

[0041] Figure 1 This is a flowchart of a data query method provided in Embodiment 1 of the present invention. This embodiment is applicable to various situations requiring statistical ranking of large amounts of data across multiple tables. The method of this embodiment can be executed by a data query device, which can be implemented by software and / or hardware. This device can be configured in a computer device, which can be a terminal device executed by a client. The present invention does not limit the type of computer device.

[0042] Accordingly, the method specifically includes the following steps:

[0043] S110. Obtain the statistical sorting request input by the user.

[0044] The statistical sorting request includes sorting criteria and the required number of rankings.

[0045] The statistical ranking request can be a request sent by the client to the server for statistical ranking. Specifically, when the client sends a statistical ranking request to the server, the server processes the data based on the received request. The sorting criteria can be sorting conditions input by the user. Data processing is performed according to the sorting criteria, which can be sorting from smallest to largest or from largest to smallest. The required number of rankings can be the number of data points after sorting.

[0046] For example, suppose the server stores relevant data to statistically analyze the employment status of citizens in various provinces of my country. When a user enters a statistical sorting request in the client as: "Statistics on the top 5 provinces with the most employed citizens in my country", the sorting criteria can be further determined as: "Statistics on the provinces with the most employed citizens in my country", and the required number of rankings is: the top 5 provinces.

[0047] S120. Send the statistical sorting request to the server and receive the unified query identifier and the number of sub-tables retrieved from the server.

[0048] The number of sub-tables is multiple.

[0049] The unified query identifier can be a unique number generated by the server based on the statistical sorting request received from the client. This unique number is used to identify the query. The unified query identifier can be a string. The number of table partitions retrieved can be the number of table partitions stored on the server related to the statistical sorting request.

[0050] Continuing the previous example, the client sends a statistical sorting request to the server. The server parses the request as follows: "Rank the top 5 provinces in my country with the most employed citizens"; the sorting condition is: "Rank the provinces in my country with the most employed citizens"; the required number of rankings is: the top 5 provinces. Based on the sorting condition, i.e., "rank the provinces in my country with the most employed citizens", the server generates a unified query identifier "XYAX0567", and the server can determine that there are 1000 retrieval tables.

[0051] S130. Based on the unified query identifier, send data retrieval requests matching the number of sub-tables to the server one by one, so as to instruct the server to generate sub-table sorting results corresponding to each sub-table one by one, and update the summary sorting results.

[0052] The data retrieval request can be a request sent by the client to the server. Specifically, when a client sends a data retrieval request to the server, the server performs a data retrieval query based on the received request. The table sorting result can be the sorting result of each table after the server performs a data retrieval on that table. The summary sorting result can be a summary of previous table sorting results. Specifically, after the server completes the current data retrieval task, it obtains the current table sorting result and updates the summary sorting result with the current table sorting result.

[0053] Optionally, based on the unified query identifier, data retrieval requests matching the number of table partitions are sent to the server sequentially, including: obtaining the current retrieval table partition number, which has a preset initial value; if it is determined that the current retrieval table partition number is less than or equal to the number of table partitions, then a data retrieval request is constructed based on the statistical query identifier and the current retrieval table partition number, and the data retrieval request is sent to the server; upon receiving a successful processing response from the server for the data retrieval request, the current retrieval table partition number is updated, and the operation of obtaining the current retrieval table partition number is returned, until the construction of data retrieval requests for all table partitions is completed.

[0054] The current retrieval sub-table number can be the specific index number of the retrieval sub-table in the retrieval server.

[0055] Continuing the previous example, the client, based on the unified query identifier "XYAX0567" and the number of retrieval tables being 1000, assumes that the current retrieval table number is 1, which means that the preset initial value is determined to be 1. Since the current retrieval table number 1 is less than the number of 1000 tables, a data retrieval request is constructed based on the statistical query identifier "XYAX0567" and the current retrieval table number 1, and sent to the server to instruct the server to generate the table sorting result corresponding to the current retrieval table number 1, and update the summary sorting result.

[0056] Furthermore, upon receiving a successful processing response from the server for the data retrieval request, the current retrieval sub-table number is updated to 2, and the process returns to retrieve the current retrieval sub-table number until the construction of the data retrieval request for all sub-tables is completed.

[0057] Correspondingly, after updating the current retrieval table number to 1001, the client completes the current data query task and sends a request to the server to obtain the sorting results.

[0058] The advantage of this setup is that by comparing the current retrieval table number with the number of tables, the client sends the corresponding request command to the server. This makes the data query and retrieval process clearer and avoids unnecessary data processing, thereby reducing the waste of data resources.

[0059] S140. Upon confirming the completion of sending all the data retrieval requests, a sorting result retrieval request is sent to the server based on the unified query identifier, instructing the server to retrieve the target sorting result matching the required number of rankings from the currently updated aggregated sorting results.

[0060] The sorting result retrieval request can be a request sent by the client to the server to obtain the sorting results. Specifically, when the client sends a sorting result retrieval request to the server, the server provides the sorting results based on the received request. The target sorting result can be obtained by extracting the top few data points from the aggregated sorting results according to the required number of rankings.

[0061] Continuing the previous example, when the server receives a request to retrieve the ranking results, it determines the required number of rankings based on the unified query identifier "XYAX0567": the top 5 provinces. It then obtains the corresponding target ranking results from the updated aggregated ranking results. Specifically, the target ranking results can be province A, province B, province C, province D, and province E.

[0062] S150: Receive the target sorting result fed back by the server.

[0063] Continuing the previous example, the server sends the target sorting result to the client, and the client can receive the target sorting result as province A, province B, province C, province D, and province E.

[0064] The technical solution provided by this invention involves: acquiring a statistical sorting request input by a user; sending the statistical sorting request to a server and receiving a unified query identifier and the number of sub-tables to be retrieved from the server; sending data retrieval requests matching the number of sub-tables to the server sequentially based on the unified query identifier, instructing the server to generate sub-table sorting results corresponding to each sub-table sequentially and update the aggregated sorting results; upon determining that all data retrieval requests have been sent, sending a sorting result retrieval request to the server based on the unified query identifier, instructing the server to retrieve a target sorting result matching the required number of rankings from the currently updated aggregated sorting results; and receiving the target sorting result from the server. This solves the problem of timeouts caused by large amounts of data processing when users perform cyclical ranking statistics on sub-tables, reduces network traffic consumption, lowers service costs, reduces the pressure on client data processing, and thus improves the efficiency of data retrieval and querying.

[0065] Example 2

[0066] Figure 2 This is a flowchart of another data query method provided in Embodiment 2 of the present invention. This embodiment is applicable to various situations requiring statistical ranking of large amounts of data in separate tables. The method of this embodiment can be executed by a data query device, which can be implemented by software and / or hardware. The device can be configured in a computer device, which can be a server, and the execution is performed by the server. The embodiments of the present invention do not limit the type of computer device.

[0067] Accordingly, the method specifically includes the following steps:

[0068] S210. Receive a statistical sorting request sent by the client, and extract the sorting conditions and the required number of rankings from the statistical sorting request.

[0069] For example, the server receives a statistical ranking request from the client. Specifically, the statistical ranking request is to rank the top 5 provinces in my country with the largest number of employed citizens. Based on the received statistical ranking request, the server extracts the corresponding ranking criteria and the required number of rankings. Specifically, the ranking criteria are: rank the provinces in my country with the largest number of employed citizens, and the required number of rankings is: the top 5 provinces.

[0070] S220. Based on the sorting conditions, determine the number of sub-tables corresponding to the retrieval sub-tables, and generate a unified query identifier that matches the statistical sorting request.

[0071] Continuing from the previous example, the server can generate a unified query identifier of "XYAX0567" based on the sorting criteria, namely "the province with the most employed citizens in my country", and the server can obtain the number of 1000 retrieval tables.

[0072] S230. Feed back the number of table partitions and the unified query identifier to the client, and store the unified query identifier, the sorting conditions, and the required number of rankings together.

[0073] Continuing from the previous example, the server sends the number of table partitions (1000) and the unified query identifier "XYAX0567" back to the client. The server also stores the unified query identifier "XYAX0567", the sorting condition "the province with the most employed citizens in my country", and the required number of rankings "the top 5 provinces" together.

[0074] S240. Based on the data retrieval requests sent sequentially by the client according to the unified query identifier, which match the number of sub-tables, generate sub-table sorting results corresponding to each sub-table sequentially according to the sorting conditions, and update the summary sorting results.

[0075] Optionally, based on the data retrieval requests sent sequentially by the client according to the unified query identifier, matching the number of sub-tables, and according to the sorting conditions, sequentially generating sub-table sorting results corresponding to each sub-table, and updating the summary sorting results, the process includes: whenever a data detection request sent by the client is received, extracting the unified query identifier and the current retrieval sub-table sequence number included in the data detection request; determining the matching target sub-table based on the current retrieval sub-table sequence number; obtaining the sorting conditions matching the unified query identifier, and generating a sub-table sorting result corresponding to the target sub-table based on the sorting conditions; detecting whether a summary sorting result corresponding to the unified query identifier is currently stored; if so, updating the summary sorting result based on the sub-table sorting result, and then sending a successful processing response corresponding to the data retrieval request back to the client.

[0076] Continuing the previous example, the server retrieves data from the corresponding partitioned table based on the data retrieval request sent by the client. Specifically, whenever the server receives a data detection request from the client, it extracts the unified query identifier "XYAX0567" and the current retrieval partition number 1 from the data detection request, and determines the matching target partitioned table based on the current retrieval partition number 1.

[0077] Furthermore, obtain the sorting condition "the province with the most employed citizens in my country" that matches the unified query identifier "XYAX0567", and generate the sub-table sorting results corresponding to the target sub-table based on the sorting condition.

[0078] Accordingly, it checks whether the summary sorting result corresponding to the unified query identifier "XYAX0567" is currently stored. If it exists, it updates the summary sorting result according to the table partitioning sorting result and sends a successful processing response to the client corresponding to the data retrieval request.

[0079] S250. Based on the sorting result retrieval request sent by the client, retrieve the target sorting result that matches the required number of rankings from the currently updated aggregated sorting results and feed it back to the client.

[0080] The technical solution provided by this invention involves receiving a statistical sorting request sent by a client, extracting sorting conditions and the required number of rankings from the request; determining the number of sub-tables corresponding to the retrieval sub-tables based on the sorting conditions, and generating a unified query identifier matching the statistical sorting request; feeding back the number of sub-tables and the unified query identifier to the client, and storing the unified query identifier, the sorting conditions, and the required number of rankings in association; generating sub-table sorting results corresponding to each sub-table according to the sorting conditions based on the data retrieval requests sent by the client sequentially based on the unified query identifier and matching the number of sub-tables, and updating the aggregated sorting results; and retrieving the target sorting result matching the required number of rankings from the currently updated aggregated sorting results based on the sorting result retrieval request sent by the client, and feeding it back to the client. This solves the problem of timeouts caused by large amounts of data processing when users perform ranking statistics on sub-tables in a loop, reduces network traffic consumption, lowers service costs, reduces the pressure on the client to process data, and thus improves the efficiency of data retrieval and querying.

[0081] Optionally, after detecting whether the summary sorting result corresponding to the unified query identifier is currently stored, the method further includes: using the table sorting result as the initialized summary sorting result, and associating the summary sorting result with the unified query identifier for storage.

[0082] Continuing the previous example, check if the summary sort result corresponding to the unified query identifier "XYAX0567" is currently stored. If it exists, update the summary sort result according to the table partitioning sort result, and then send a successful processing response to the client corresponding to the data retrieval request. If it does not exist, use the table partitioning sort result as the initial summary sort result, and associate the summary sort result with the unified query identifier "XYAX0567" for storage.

[0083] The advantage of this setup is that when the server does not store the summary sorting results corresponding to the unified query identifier, the table-sorting results need to be used as the initial summary sorting results. This ensures that the table-sorting results are stored in a timely manner each time, and the summary sorting results are updated, thereby avoiding errors in data query statistics and obtaining more accurate target sorting results.

[0084] Optionally, after obtaining the target sorting result matching the required number of rankings and feeding it back to the client, the method further includes: when it is determined that the client has successfully received the target sorting result, clearing the stored unified query identifier, the sorting condition, and the required number of rankings.

[0085] Continuing from the previous example, when the server determines that the client has successfully received the target sorting result, the server needs to clear the stored unified query identifier "XYAX0567", the sorting condition "the province with the most employed citizens in my country" and the required number of rankings "the top 5 provinces".

[0086] The advantage of this setup is that once the server determines that the client has successfully received the target sorting result, the server needs to clear the relevant data. This avoids storing useless data on the server, which would waste memory resources and thus improve the data query and retrieval speed.

[0087] Example 3

[0088] Figure 3 This is a schematic diagram of a data query device provided in Embodiment 3 of the present invention. The data query device provided in this embodiment can be implemented by software and / or hardware, and can be configured in a terminal device to implement a data query method according to the embodiments of the present invention. Figure 3 As shown, the device may specifically include: a statistical sorting request acquisition module 310, a unified query identifier and a table number receiving module 320, a table sorting result generation module 330, a target sorting result acquisition module 340, and a target sorting result receiving module 350.

[0089] The statistical sorting request acquisition module 310 is used to acquire the statistical sorting request input by the user, wherein the statistical sorting request includes sorting conditions and the required number of rankings.

[0090] The unified query identifier and the number of retrieval sub-tables receiving module 320 are used to send the statistical sorting request to the server and receive the unified query identifier and the number of retrieval sub-tables fed back by the server, wherein the number of sub-tables is multiple.

[0091] The table sorting result generation module 330 is used to send data retrieval requests matching the number of tables to the server one by one according to the unified query identifier, so as to instruct the server to generate the table sorting result corresponding to each table one by one and update the summary sorting result.

[0092] The target sorting result acquisition module 340 is used to send a sorting result acquisition request to the server according to the unified query identifier when it is determined that the sending of all the data retrieval requests has been completed, so as to instruct the server to acquire the target sorting result that matches the required number of rankings in the currently updated summary sorting result;

[0093] The target sorting result receiving module 350 is used to receive the target sorting result fed back by the server.

[0094] The technical solution provided by this invention involves: acquiring a statistical sorting request input by a user; sending the statistical sorting request to a server and receiving a unified query identifier and the number of sub-tables to be retrieved from the server; sending data retrieval requests matching the number of sub-tables to the server sequentially based on the unified query identifier, instructing the server to generate sub-table sorting results corresponding to each sub-table sequentially and update the aggregated sorting results; upon determining that all data retrieval requests have been sent, sending a sorting result retrieval request to the server based on the unified query identifier, instructing the server to retrieve a target sorting result matching the required number of rankings from the currently updated aggregated sorting results; and receiving the target sorting result from the server. This solves the problem of timeouts caused by large amounts of data processing when users perform cyclical ranking statistics on sub-tables, reduces network traffic consumption, lowers service costs, reduces the pressure on client data processing, and thus improves the efficiency of data retrieval and querying.

[0095] Based on the above embodiments, the table sorting result generation module 330 can be specifically used to: obtain the current retrieval table number, which has a preset initial value; if it is determined that the current retrieval table number is less than or equal to the number of tables, then construct a data retrieval request based on the statistical query identifier and the current retrieval table number, and send the data retrieval request to the server; upon receiving a successful processing response from the server for the data retrieval request, update the current retrieval table number, and return to execute the operation of obtaining the current retrieval table number, until the construction of the data retrieval request for all tables is completed.

[0096] The data query device described above can execute the data query method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0097] Example 4

[0098] Figure 4 This is a schematic diagram of another data query device provided in Embodiment 4 of the present invention. The data query device provided in this embodiment can be implemented by software and / or hardware, and can be configured in a server to implement a data query method according to the embodiments of the present invention. Figure 4 As shown, the device may specifically include: a statistical sorting request receiving module 410, a unified query identifier generation module 420, an association storage module 430, a summary sorting result update module 440, and a target sorting result feedback module 450.

[0099] The statistical sorting request receiving module 410 is used to receive a statistical sorting request sent by the client and extract the sorting conditions and the required number of rankings from the statistical sorting request.

[0100] The unified query identifier generation module 420 is used to determine the number of sub-tables corresponding to the retrieval sub-tables according to the sorting conditions, and generate a unified query identifier that matches the statistical sorting request.

[0101] The associated storage module 430 is used to feed back the number of table partitions and the unified query identifier to the client, and to associate and store the unified query identifier, the sorting conditions and the required number of rankings.

[0102] The summary sorting result update module 440 is used to generate the sub-table sorting result corresponding to each sub-table according to the sorting conditions based on the data retrieval requests sent by the client according to the unified query identifier and matching the number of sub-tables, and update the summary sorting result.

[0103] The target sorting result feedback module 450 is used to retrieve the target sorting result that matches the required number of rankings from the currently updated aggregated sorting results and feed it back to the client based on the sorting result retrieval request sent by the client.

[0104] The technical solution provided by this invention involves receiving a statistical sorting request sent by a client, extracting sorting conditions and the required number of rankings from the request; determining the number of sub-tables corresponding to the retrieval sub-tables based on the sorting conditions, and generating a unified query identifier matching the statistical sorting request; feeding back the number of sub-tables and the unified query identifier to the client, and storing the unified query identifier, the sorting conditions, and the required number of rankings in association; generating sub-table sorting results corresponding to each sub-table according to the sorting conditions based on the data retrieval requests sent by the client sequentially based on the unified query identifier and matching the number of sub-tables, and updating the aggregated sorting results; and retrieving the target sorting result matching the required number of rankings from the currently updated aggregated sorting results based on the sorting result retrieval request sent by the client, and feeding it back to the client. This solves the problem of timeouts caused by large amounts of data processing when users perform ranking statistics on sub-tables in a loop, reduces network traffic consumption, lowers service costs, reduces the pressure on the client to process data, and thus improves the efficiency of data retrieval and querying.

[0105] Based on the above embodiments, the summary sorting result update module 440 may specifically include: a unified query identifier and current retrieval sub-table number extraction unit, used to extract the unified query identifier and current retrieval sub-table number included in the data detection request whenever a data detection request sent by the client is received; a target sub-table determination unit, used to determine the matching target sub-table based on the current retrieval sub-table number; a sub-table sorting result generation unit, used to obtain the sorting conditions matching the unified query identifier, and generate a sub-table sorting result corresponding to the target sub-table based on the sorting conditions; a summary sorting result detection unit, used to detect whether a summary sorting result corresponding to the unified query identifier is currently stored; and a successful processing response feedback unit, used to determine that a summary sorting result corresponding to the unified query identifier is currently stored, and then update the summary sorting result based on the sub-table sorting result, and then send a successful processing response corresponding to the data retrieval request back to the client.

[0106] Based on the above embodiments, an initialization module is also included, which can be specifically used to: after detecting whether the summary sorting result corresponding to the unified query identifier is currently stored, use the table sorting result as the initialized summary sorting result, and associate the summary sorting result with the unified query identifier for storage.

[0107] Based on the above embodiments, a storage clearing module is also included, which can be specifically used to: after obtaining the target sorting result matching the required sorting quantity and feeding it back to the client, when it is determined that the client has successfully received the target sorting result, clear the stored unified query identifier, the sorting condition and the required sorting quantity.

[0108] The data query device described above can execute the data query method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0109] Example 5

[0110] Figure 5 This is a schematic diagram of the structure of a computer device provided in Embodiment 5 of the present invention. Figure 5 As shown, the device includes a processor 510, a memory 520, an input device 530, and an output device 540; the number of processors 510 in the device can be one or more. Figure 5 Taking a processor 510 as an example; the processor 510, memory 520, input device 530, and output device 540 in the device can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.

[0111] The memory 520, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the data query method in the embodiments of the present invention (e.g., statistical sorting request acquisition module 310, unified query identifier and retrieval table number receiving module 320, table sorting result generation module 330, target sorting result acquisition module 340, and target sorting result receiving module 350). The processor 510 executes various functional applications and data processing of the device by running software programs, instructions, and modules stored in the memory 520, thereby implementing the aforementioned data query method. This method includes: acquiring a statistical sorting request input by a user, the statistical sorting request including sorting conditions and the required number of rankings; sending the statistical sorting request to a server and receiving a unified query identifier and the number of sub-tables to be retrieved from the server, the number of sub-tables being multiple; sending data retrieval requests matching the number of sub-tables to the server sequentially according to the unified query identifier, to instruct the server to sequentially generate sub-table sorting results corresponding to each sub-table and update the summary sorting results; upon determining that all data retrieval requests have been sent, sending a sorting result retrieval request to the server according to the unified query identifier, to instruct the server to retrieve a target sorting result matching the required number of rankings from the currently updated summary sorting results; and receiving the target sorting result from the server.

[0112] The memory 520, as a computer-readable storage medium, can be used to store software programs, computer-executable programs and modules, or program instructions / modules corresponding to the data query method in the embodiments of the present invention (e.g., statistical sorting request receiving module 410, unified query identifier generation module 420, associated storage module 430, summary sorting result update module 440 and target sorting result feedback module 450). The processor 510 executes various functional applications and data processing of the device by running software programs, instructions, and modules stored in the memory 520, thereby implementing the aforementioned data query method. This method includes: receiving a statistical sorting request sent by a client, and extracting sorting conditions and the required number of rankings from the statistical sorting request; determining the number of sub-tables corresponding to the retrieval sub-tables based on the sorting conditions, and generating a unified query identifier matching the statistical sorting request; feeding back the number of sub-tables and the unified query identifier to the client, and storing the unified query identifier, the sorting conditions, and the required number of rankings in association; generating sub-table sorting results corresponding to each sub-table according to the sorting conditions based on the data retrieval requests sent sequentially by the client based on the unified query identifier and matching the number of sub-tables, and updating the summary sorting results; and obtaining a target sorting result matching the required number of rankings from the currently updated summary sorting results based on a sorting result retrieval request sent by the client, and feeding it back to the client.

[0113] The memory 520 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on terminal usage. Furthermore, the memory 520 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory, or other non-volatile solid-state storage device. In some instances, the memory 520 may further include memory remotely located relative to the processor 510, which can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0114] Input device 530 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device. Output device 540 may include display devices such as a display screen.

[0115] Example 6

[0116] Embodiment 6 of the present invention also provides a computer-readable storage medium, wherein the computer-readable instructions, when executed by a computer processor, are used to perform a data query method. The method includes: obtaining a statistical sorting request input by a user, the statistical sorting request including sorting conditions and a required number of rankings; sending the statistical sorting request to a server and receiving a unified query identifier and a number of retrieval tables from the server, the number of retrieval tables being multiple; according to the unified query identifier, sending data retrieval requests matching the number of retrieval tables to the server sequentially, to instruct the server to sequentially generate retrieval table sorting results corresponding to each retrieval table, and updating the summary sorting results; upon determining that all data retrieval requests have been sent, sending a sorting result retrieval request to the server according to the unified query identifier, to instruct the server to retrieve a target sorting result matching the required number of rankings from the currently updated summary sorting results; and receiving the target sorting result from the server.

[0117] Alternatively, the method may include: receiving a statistical sorting request sent by a client, and extracting sorting conditions and the required number of rankings from the statistical sorting request; determining the number of sub-tables corresponding to the retrieval sub-tables according to the sorting conditions, and generating a unified query identifier matching the statistical sorting request; feeding back the number of sub-tables and the unified query identifier to the client, and storing the unified query identifier, the sorting conditions, and the required number of rankings in association; generating sub-table sorting results corresponding to each sub-table according to the sorting conditions based on the data retrieval requests sent by the client according to the unified query identifier and matching the number of sub-tables, and updating the summary sorting results; and obtaining the target sorting result matching the required number of rankings from the currently updated summary sorting results and feeding it back to the client based on the sorting result retrieval request sent by the client.

[0118] Of course, the computer-readable instructions provided in the embodiments of the present invention, which include a computer-readable storage medium, are not limited to the method operations described above, but can also perform related operations in the data query method provided in any embodiment of the present invention.

[0119] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0120] It is worth noting that in the embodiments of the above data query device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.

[0121] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. A data query method, executed by a client, characterized in that, include: Obtain a statistical sorting request input by the user, the statistical sorting request including sorting conditions and the required number of rankings; The statistical sorting request is sent to the server, and the server sends back a unified query identifier and the number of shards to be retrieved, wherein there are multiple shards. Based on the unified query identifier, data retrieval requests matching the number of sub-tables are sent to the server one by one to instruct the server to generate sub-table sorting results corresponding to each sub-table and update the aggregate sorting results. Upon confirming the completion of sending all the data retrieval requests, a sorting result retrieval request is sent to the server based on the unified query identifier, instructing the server to retrieve the target sorting result matching the required number of rankings from the currently updated aggregated sorting results. Receive the target sorting result fed back by the server; Specifically, based on the unified query identifier, sending data retrieval requests matching the number of table partitions to the server sequentially includes: Obtain the current search sub-table index, which has a preset initial value; If it is determined that the current retrieval table number is less than or equal to the number of tables, then a data retrieval request is constructed based on the unified query identifier and the current retrieval table number, and the data retrieval request is sent to the server; Upon receiving a successful processing response from the server for the data retrieval request, the current retrieval sub-table number is updated, and the operation of obtaining the current retrieval sub-table number is returned until the construction of the data retrieval request for all sub-tables is completed. The sorting criteria are the sorting conditions requested by the user, including sorting from smallest to largest or from largest to smallest; the required number of rankings is the number of data items to retrieve after sorting.

2. A data query method, executed by a server, characterized in that, include: Receive a statistical sorting request sent by the client, and extract the sorting criteria and the required number of rankings from the statistical sorting request; Based on the sorting criteria, determine the number of sub-tables corresponding to the retrieval sub-tables, and generate a unified query identifier that matches the statistical sorting request; The number of table partitions and the unified query identifier are fed back to the client, and the unified query identifier, the sorting conditions, and the required number of rankings are stored together. Based on the data retrieval requests sent sequentially by the client according to the unified query identifier, which match the number of sub-tables, the sub-table sorting results corresponding to each sub-table are generated sequentially according to the sorting conditions, and the summary sorting results are updated. Based on the sorting result retrieval request sent by the client, the target sorting result matching the required number of rankings is retrieved from the currently updated aggregated sorting results and fed back to the client; Specifically, based on the data retrieval requests sent sequentially by the client according to the unified query identifier, matching the number of sub-tables, a sub-table sorting result corresponding to each sub-table is generated sequentially according to the sorting conditions, and the aggregated sorting result is updated, including: Whenever a data detection request is received from the client, the unified query identifier and the current retrieval sub-table number included in the data detection request are extracted; Based on the current retrieval table number, determine the target table to be matched; Obtain the sorting conditions that match the unified query identifier, and generate the table sorting results corresponding to the target table based on the sorting conditions; Check whether the summary sorting result corresponding to the unified query identifier is currently stored; If so, then based on the sorting results of the sub-tables, after updating the summary sorting results, a successful processing response corresponding to the data retrieval request is sent back to the client; The process includes, after obtaining the target ranking result matching the required ranking quantity and feeding it back to the client, the following steps are also included: When it is determined that the client has successfully received the target ranking result, the stored unified query identifier, the ranking conditions, and the required number of rankings are cleared.

3. The method according to claim 2, characterized in that, After detecting whether the aggregated sorting result corresponding to the unified query identifier is currently stored, the method further includes: The sorting result of the sub-table is used as the initial summary sorting result, and the summary sorting result is associated with and stored with the unified query identifier.

4. A data query device, executed by a client, characterized in that, include: The statistical sorting request acquisition module is used to acquire the statistical sorting request input by the user, wherein the statistical sorting request includes sorting conditions and the required number of rankings; The module for receiving the unified query identifier and the number of retrieval tables is used to send the statistical sorting request to the server and receive the unified query identifier and the number of retrieval tables from the server, wherein the number of retrieval tables is multiple. The table sorting result generation module is used to send data retrieval requests matching the number of tables to the server one by one according to the unified query identifier, so as to instruct the server to generate the table sorting result corresponding to each table one by one and update the summary sorting result. The target ranking result acquisition module is used to send a ranking result acquisition request to the server according to the unified query identifier when it is determined that the sending of all the data retrieval requests has been completed, so as to instruct the server to acquire the target ranking result that matches the required number of rankings in the currently updated summary ranking result; The target sorting result receiving module is used to receive the target sorting result fed back by the server; The table sorting result generation module is configured to: obtain the current retrieval table number, which has a preset initial value; if it is determined that the current retrieval table number is less than or equal to the number of tables, construct a data retrieval request based on the unified query identifier and the current retrieval table number, and send the data retrieval request to the server; upon receiving a successful processing response from the server for the data retrieval request, update the current retrieval table number, and then return to execute the operation of obtaining the current retrieval table number until the construction of the data retrieval request for all tables is completed; The sorting criteria are the sorting conditions requested by the user, including sorting from smallest to largest or from largest to smallest; the required number of rankings is the number of data items to retrieve after sorting.

5. A data query device, executed by a server, characterized in that, include: The statistical sorting request receiving module is used to receive statistical sorting requests sent by the client and extract sorting conditions and the required number of rankings from the statistical sorting requests; The unified query identifier generation module is used to determine the number of sub-tables corresponding to the retrieval sub-tables based on the sorting conditions, and generate a unified query identifier that matches the statistical sorting request. The associated storage module is used to feed back the number of table partitions and the unified query identifier to the client, and to associate and store the unified query identifier, the sorting conditions, and the required number of rankings. The summary sorting result update module is used to generate the sub-table sorting result corresponding to each sub-table in turn according to the sorting conditions based on the data retrieval requests sent by the client in turn according to the unified query identifier and matching the number of sub-tables, and update the summary sorting result. The target sorting result feedback module is used to retrieve the target sorting result that matches the required number of rankings from the currently updated aggregate sorting results and feed it back to the client based on the sorting result retrieval request sent by the client. The summary sorting result update module includes: a unified query identifier and current retrieval sub-table number extraction unit, used to extract the unified query identifier and current retrieval sub-table number included in the data detection request whenever a data detection request sent by the client is received; a target sub-table determination unit, used to determine the matching target sub-table based on the current retrieval sub-table number; a sub-table sorting result generation unit, used to obtain the sorting conditions matching the unified query identifier and generate a sub-table sorting result corresponding to the target sub-table based on the sorting conditions; a summary sorting result detection unit, used to detect whether a summary sorting result corresponding to the unified query identifier is currently stored; and a successful processing response feedback unit, used to determine that a summary sorting result corresponding to the unified query identifier is currently stored, and then update the summary sorting result based on the sub-table sorting result and send a successful processing response corresponding to the data retrieval request back to the client. It also includes a storage clearing module, used to: after obtaining the target sorting result matching the required number of rankings and feeding it back to the client, and upon determining that the client has successfully received the target sorting result, clear the stored unified query identifier, the sorting condition, and the required number of rankings.

6. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the data query method as described in claim 1, or the data query method as described in any one of claims 2-3.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the data query method as described in claim 1, or the data query method as described in any one of claims 2-3.

Citation Information

Patent Citations

  • Data query method and device

    CN110737676A