Data query method, system, and apparatus

By performing structural analysis on data query requests and filtering target leaf query statements, the problems of low efficiency and high memory consumption in massive data queries are solved, and efficient and accurate data query results are achieved.

CN116303544BActive Publication Date: 2026-05-12ALIBABA CLOUD COMPUTING CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ALIBABA CLOUD COMPUTING CO LTD
Filing Date
2023-03-31
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing technologies suffer from low query efficiency and high memory consumption when querying massive amounts of data, especially when nesting join statements within subqueries, which leads to decreased computational efficiency and increased memory consumption.

Method used

By receiving data query requests, performing structural analysis, filtering target leaf query statements and their result sets that meet preset filtering conditions, determining whether the target query result hits the leaf query statement to be queried, and determining the query result according to the retention and rejection rules, the calculation of intermediate sub-joint query statements is avoided, reducing invalid performance and memory consumption.

Benefits of technology

It improves the efficiency of data retrieval, reduces memory consumption, optimizes the query process, and ensures the accuracy and efficiency of query results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116303544B_ABST
    Figure CN116303544B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a data query method, system and device, wherein the data query method comprises: receiving a data query request; performing structural analysis on at least one joint query statement to determine a plurality of leaf query statements; from the plurality of leaf query statements, screening a target leaf query statement and a target query result set of the target leaf query statement that meet a preset screening condition; determining whether each target query result in the target query result set hits a to-be-queried leaf query statement to obtain a determination result; and determining a target query result corresponding to the data query request according to a go-or-leave determination rule corresponding to the to-be-queried leaf query statement and the determination result. By using the target query result set to check whether the to-be-queried leaf query statement is hit, the target query result is obtained, and there is no need to calculate intermediate sub-joint query statements, thereby controlling the invalid performance and memory loss of a large number of query intermediate sub-joint query statements, and improving the efficiency of data query.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and in particular to a data query method. One or more embodiments of this specification also relate to a data query system, a data query device, a computing device, a computer-readable storage medium, and a computer program. Background Technology

[0002] With the continuous development of computer technology, the amount of data generated by enterprises or individual users is growing explosively. How to efficiently and accurately query data in massive amounts of data has gradually become a research focus.

[0003] Currently, data retrieval typically utilizes multi-condition join queries: first, operations are performed on the sub-joint queries within the join query to obtain a set of sub-joint document results; then, these sub-joint document results are combined with other sub-document result sets to obtain the query result. However, when the number of results obtained from the query is too large, and join queries are nested within subqueries, the efficiency of this approach decreases sharply. Therefore, a more efficient data retrieval solution is urgently needed. Summary of the Invention

[0004] In view of this, embodiments of this specification provide a data query method. One or more embodiments of this specification also relate to a data query system, a data query device, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.

[0005] According to a first aspect of the embodiments of this specification, a data query method is provided, comprising: receiving a data query request, wherein the data query request includes at least one joint query statement; performing structural analysis on the at least one joint query statement to determine a plurality of leaf query statements; filtering from the plurality of leaf query statements a target leaf query statement that meets preset filtering conditions and a target query result set of the target leaf query statements; determining whether each target query result in the target query result set hits a leaf query statement to be queried, and obtaining a determination result, wherein the leaf query statement to be queried is a leaf query statement other than the target leaf query statement among the plurality of leaf query statements; determining the target query result corresponding to the data query request according to the retention / discard determination rule corresponding to the leaf query statement to be queried and the determination result, wherein the retention / discard determination rule corresponding to the leaf query statement to be queried is determined according to the set operation type corresponding to the parent query of the leaf query statement to be queried.

[0006] According to a second aspect of the embodiments of this specification, a data query system is provided, including a client and a server; the client is configured to send a data query request to the server, wherein the data query request includes at least one union query statement; the server is configured to process the data query request according to the data query method provided in any embodiment of this specification.

[0007] According to a third aspect of the embodiments of this specification, a data query apparatus is provided, comprising: a receiving module configured to receive a data query request, wherein the data query request includes at least one joint query statement; an analysis module configured to perform structural analysis on the at least one joint query statement to determine a plurality of leaf query statements; a filtering module configured to filter target leaf query statements and a target query result set of the target leaf query statements from the plurality of leaf query statements, wherein the target query statement is a leaf query statement other than the target leaf query statement among the plurality of leaf query statements; and a determining module configured to determine the target query result corresponding to the data query request based on the retention / discard judgment rule corresponding to the leaf query statement to be queried and the judgment result, wherein the retention / discard judgment rule corresponding to the leaf query statement to be queried is determined based on the set operation type corresponding to the parent query of the leaf query statement to be queried.

[0008] According to a fourth aspect of the embodiments of this specification, a computing device is provided, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, wherein the computer-executable instructions, when executed by the processor, implement the steps of the above-described data query method.

[0009] According to a fifth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the data query method described above.

[0010] According to a sixth aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described data query method.

[0011] This specification provides a data query method according to one embodiment, which receives a data query request, wherein the data query request includes at least one joint query statement; performs structural analysis on the at least one joint query statement to determine multiple leaf query statements; filters target leaf query statements and target query result sets of the target leaf query statements from the multiple leaf query statements, based on preset filtering conditions; determines whether each target query result in the target query result set matches a leaf query statement to be queried, and obtains a determination result, wherein the leaf query statement to be queried is a leaf query statement other than the target leaf query statement among the multiple leaf query statements; and determines the target query result corresponding to the data query request based on the retention / discard judgment rule corresponding to the leaf query statement to be queried and the determination result, wherein the retention / discard judgment rule corresponding to the leaf query statement to be queried is determined based on the set operation type corresponding to the parent query of the leaf query statement to be queried. By filtering the target leaf query statements and the target query result sets of the target leaf queries, and using the target query result set to check whether the leaf query statement to be queried matches, the target query result corresponding to the data query request is obtained. This eliminates the need to calculate intermediate sub-joint query statements, thereby controlling the ineffective performance and memory consumption of a large number of intermediate sub-joint query statements and improving the efficiency of data querying. Attached Figure Description

[0012] Figure 1 This is a flowchart of a data query method provided by a traditional solution;

[0013] Figure 2 This is an architecture diagram of a data query system provided in one embodiment of this specification;

[0014] Figure 3 This is an architecture diagram of another data query system provided in one embodiment of this specification;

[0015] Figure 4 This is a flowchart illustrating a data query method provided in one embodiment of this specification;

[0016] Figure 5a This is a schematic diagram of a combined query statement in a data query method provided in one embodiment of this specification;

[0017] Figure 5b This is a schematic diagram of a combined query statement in a data query method provided in one embodiment of this specification;

[0018] Figure 6 This is a flowchart illustrating the processing procedure of a data query method provided in one embodiment of this specification;

[0019] Figure 7 This is a flowchart illustrating the processing procedure of another data query method provided in one embodiment of this specification;

[0020] Figure 8 This is a schematic diagram of a data query interface provided in one embodiment of this specification;

[0021] Figure 9 This is a schematic diagram of the structure of a data query device provided in one embodiment of this specification;

[0022] Figure 10 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0023] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0024] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0025] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0026] Furthermore, it should be noted that one or more embodiments of this specification may involve the use of user data. In practical applications, user-specific personal data may be used in the scheme described herein within the scope permitted by applicable laws and regulations, provided that it complies with the applicable laws and regulations of the country in which it is located (e.g., with the user's explicit consent, with the user being properly notified, etc.).

[0027] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0028] Search engine: An information retrieval system used to assist in searching information stored in a computer system.

[0029] Memory search engine: refers to an information retrieval system where data is stored in memory.

[0030] Union query: Combines multiple query statements with various relationships to perform a query.

[0031] Subquery statements: Multiple query statements in a union query statement are called subquery statements of that union query statement.

[0032] Sub-join query statement: The subquery statement is a nested join query statement.

[0033] With the continuous development of computer technology, the amount of data generated by enterprises or individual users is growing explosively. This data can be retrieved using multi-condition combined queries provided by search engine services (such as memory search engines). See also... Figure 1 , Figure 1 The flowchart illustrates a data query method provided by a traditional approach. For example... Figure 1 As shown, in a join query, after retrieving the corresponding sub-document result sets from the leaf queries in the join query statement, intersection, union, and difference operations are performed on each type of sub-document result set according to the corresponding join conditions. When a sub-join query statement 1 is nested within a sub-join query statement, the intersection, union, and difference operations are first performed on the leaf queries 1-1 and 1-2 in the sub-join query statement 1 to obtain the sub-join document result set 1. Then, the intersection, union, and difference operations are performed on the sub-join document result set 1 and the sub-document result set 2 corresponding to the leaf query statement 2 to obtain the final document result set.

[0034] However, in query scenarios involving intersection set operations, if a subquery contains nested sub-joint queries, the sub-joint document result set obtained after the join query includes many documents, but the number of these documents appearing in the final result set is very small. Most of the query time is consumed in fetching and building the sub-document set. Therefore, such queries can be considered invalid queries, which not only affect computational efficiency but also generate a large amount of temporary memory consumption, leading to a sudden increase and instability in service memory consumption.

[0035] To address the aforementioned issues, this specification provides a data query solution that supports flexible query scenarios, accelerates joint queries in search engines, improves query efficiency, and reduces memory consumption. Specifically, it receives a data query request, which includes at least one joint query statement; performs structural analysis on the at least one joint query statement to determine multiple leaf query statements; filters target leaf query statements and target query result sets of the target leaf query statements from the multiple leaf query statements, ensuring they meet preset filtering conditions; determines whether each target query result in the target query result set matches the leaf query statement to be queried, obtaining a determination result, wherein the leaf query statement to be queried is a leaf query statement other than the target leaf query statement among the multiple leaf query statements; and determines the target query result corresponding to the data query request based on the retention / discard rules and determination result corresponding to the leaf query statement to be queried, wherein the retention / discard rules corresponding to the leaf query statement to be queried are determined based on the set operation type corresponding to the parent query of the leaf query statement to be queried. By filtering the target leaf query statement and the target query result set of the target leaf query statement, and using the target query result set to check whether the leaf query statement to be queried is hit, the target query result corresponding to the data query request is obtained. There is no need to calculate the intermediate sub-join query statements, thereby controlling the invalid performance and memory consumption of a large number of intermediate sub-join query statements and improving the efficiency of data query.

[0036] This specification provides a data query method, and also relates to a data query system, a data query device, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.

[0037] See Figure 2 , Figure 2 This specification illustrates an architecture diagram of a data query system provided in one embodiment of the specification. The data query system may include a client 100 and a server 200.

[0038] Client 100 is used to send a data query request to server 200, wherein the data query request includes at least one union query statement;

[0039] Server 200 is used to process the data query request according to the data query method provided in any embodiment of this specification.

[0040] Specifically, server 200 performs structural analysis on at least one joint query statement to determine multiple leaf query statements; from the multiple leaf query statements, it filters target leaf query statements that meet preset filtering conditions and the target query result set of the target leaf query statements; it determines whether each target query result in the target query result set hits the leaf query statement to be queried, and obtains a judgment result, wherein the leaf query statement to be queried is a leaf query statement other than the target leaf query statement among the multiple leaf query statements; based on the retention / discard judgment rules and judgment results corresponding to the leaf query statement to be queried, it determines the target query result corresponding to the data query request, wherein the retention / discard judgment rules corresponding to the leaf query statement to be queried are determined according to the set operation type corresponding to the parent query of the leaf query statement to be queried; and it sends the target query result corresponding to the data query request to client 100.

[0041] Client 100 is also used to receive the target query results sent by server 200.

[0042] The solution implemented in this specification allows for the filtering of target leaf query statements and target query result sets of target leaf query statements. By using the target query result set to check whether the leaf query statement to be queried is hit, the target query result corresponding to the data query request can be obtained. This eliminates the need to calculate intermediate sub-joint query statements, thereby controlling the ineffective performance and memory consumption of a large number of intermediate sub-joint query statements and improving the efficiency of data query.

[0043] See Figure 3 , Figure 3 This specification illustrates an architecture diagram of another data query system provided in one embodiment. The data query system may include multiple clients 100 and a server 200. The multiple clients 100 can establish communication connections through the server 200. In a data query scenario, the server 200 is used to provide data query services between the multiple clients 100. The multiple clients 100 can act as either senders or receivers, communicating through the server 200.

[0044] Users can interact with server 200 through client 100 to receive data sent by other clients 100, or send data to other clients 100, etc. In a data query scenario, users can publish data streams to server 200 through client 100, server 200 can generate data query results based on the data stream, and push the data query results to other clients that have established communication.

[0045] In this system, client 100 and server 200 establish a connection via a network. The network provides the medium for communication between client 100 and server 200. The network can include various connection types, such as wired or wireless communication links or fiber optic cables. Data transmitted by client 100 may need to undergo encoding, transcoding, compression, or other processing before being published to server 200.

[0046] Client 100 can be a browser, an app (application), a web application such as an H5 (HyperText Markup Language 5) application, a lightweight application (also known as a mini-program), or a cloud application. Client 100 can be developed based on the software development kit (SDK) provided by the server, such as a real-time communication (RTC) SDK. Client 100 can be deployed on electronic devices and depends on the device or certain apps running on the device. Electronic devices may have displays and support information browsing, such as personal mobile terminals like smartphones, tablets, and personal computers. Various other types of applications can also be configured on electronic devices, such as human-computer interaction applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, and social media platforms.

[0047] Server 200 may include servers providing various services, such as servers providing communication services for multiple clients, servers supporting backend training of models used on clients, and servers processing data sent by clients. It should be noted that server 200 can be implemented as a distributed server cluster composed of multiple servers, or as a single server. The server can also be a server in a distributed system, or a server integrated with blockchain. The server can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0048] It is worth noting that the data query method provided in the embodiments of this specification is generally executed by the server. However, in other embodiments of this specification, the client may also have similar functions to the server, thereby executing the data query method provided in the embodiments of this specification. In other embodiments, the data query method provided in the embodiments of this specification may also be executed jointly by the client and the server.

[0049] See Figure 4 , Figure 4 This specification shows a flowchart of a data query method according to an embodiment, which specifically includes the following steps:

[0050] Step 402: Receive a data query request, wherein the data query request includes at least one union query statement.

[0051] In one or more embodiments of this specification, a data query request including at least one joint query statement can be received, and the data query can be performed using at least one joint query statement in the data query request, thereby completing the data query task and obtaining the target query result corresponding to the data query request.

[0052] Specifically, a union query statement refers to a statement that includes multiple subqueries. The subqueries in a union query statement can be combined using various query relationship conditions (such as intersection, union, and difference). Therefore, a union query statement can also be called a union condition query statement. Subqueries in a union query statement can include sub-union queries and leaf queries. Leaf queries do not contain union queries, while sub-union queries contain nested union queries.

[0053] Step 404: Perform structural analysis on at least one union query statement to identify multiple leaf query statements.

[0054] In one or more embodiments of this specification, after receiving a data query request, the structure of at least one joint query statement can be analyzed to determine multiple leaf query statements.

[0055] Specifically, the basic structure of a union query statement includes a select field (SELECT) to indicate what content should be displayed in the results, a source field (FROM) to indicate the data source, a filter field (WHERE) to indicate the conditions for filtering, and so on.

[0056] In practical applications, there are various ways to perform structural analysis on at least one joined query statement to determine multiple leaf query statements. The specific method chosen depends on the actual situation, and this specification does not impose any limitations on this approach. One possible implementation of this specification involves using a decomposition tool with statement structure splitting capabilities to determine multiple leaf query statements from at least one joined query statement. Another possible implementation involves identifying the selection fields and their corresponding selection content within at least one joined query statement; leaf query statements are then determined based on each selection field and its corresponding selection content, wherein the number of leaf query statements is the same as the number of selection fields.

[0057] Step 406: From multiple leaf query statements, filter the target leaf query statements that meet the preset filtering conditions and the target query result set of the target leaf query statements.

[0058] In one or more embodiments of this specification, after receiving a data query request, performing structural analysis on at least one joint query statement, and determining multiple leaf query statements, further, target leaf query statements that meet preset filtering conditions and target query result sets of the target leaf query statements can be selected from the multiple leaf query statements.

[0059] Specifically, preset filtering conditions are used to filter target leaf query statements from multiple leaf query statements, including but not limited to the smallest query result size, the query result size being less than a preset threshold, etc. The specific selection is based on the actual situation, and this specification does not impose any limitations on this embodiment. The target query result set refers to the query document result set of the target leaf query statement, and the query document result set includes at least one query result (document).

[0060] In practical applications, there are various ways to filter target leaf query statements and target query result sets that meet preset filtering conditions from multiple leaf query statements. The specific method should be selected according to the actual situation. This specification does not limit the specific methods used in this embodiment.

[0061] In one possible implementation of this specification, the process of filtering target leaf query statements and the target query result set of target leaf query statements from multiple leaf query statements that meet preset filtering conditions may include the following steps:

[0062] Get the size of the set of query results corresponding to multiple leaf queries;

[0063] The comparison results are obtained by comparing the size of the set of query results corresponding to the preset filtering conditions and each leaf query statement;

[0064] Based on the comparison results, the target query result set is selected from the query result sets corresponding to each leaf query statement, and the leaf query statement corresponding to the target query result set is taken as the target leaf query statement.

[0065] For example, suppose the preset filtering condition is that the query structure size is less than 6, and there are three leaf queries. The size of the result set 1 of leaf query 1 is 3, the size of the result set 2 of leaf query 2 is 4, and the size of the result set 3 of leaf query 3 is 9. By comparing the preset filtering condition with the size of the result sets corresponding to each leaf query, it is determined that result set 1 and result set 2 meet the preset filtering condition. Therefore, result set 2 can be randomly selected from result set 1 and result set 2 as the target result set, and the leaf query 2 corresponding to result set 2 can be selected as the target leaf query.

[0066] In another possible implementation of this specification, the above-mentioned filtering of target leaf query statements and target query result sets of target leaf query statements from multiple leaf query statements that meet preset filtering conditions may include the following steps:

[0067] Get the size of the set of query results corresponding to multiple leaf queries;

[0068] Select the smallest result set from the result sets corresponding to multiple leaf queries as the target result set, and use the leaf query statement corresponding to the target result set as the target leaf query statement.

[0069] Specifically, the size of the query result set can be determined based on the number of query results in the query result set, or based on the data size of the query result set.

[0070] For example, suppose there are three leaf queries: the result set 1 of leaf query 1 has a size of 3, the result set 2 of leaf query 2 has a size of 4, and the result set 3 of leaf query 3 has a size of 9. By comparing the sizes of each result set, the result set with the smallest size is determined to be result set 1. Therefore, result set 1 can be used as the target result set, and the leaf query 1 corresponding to result set 1 can be used as the target leaf query.

[0071] It is worth noting that, in order to ensure that the target query result corresponding to the data query request can be obtained, when filtering the target leaf query statement that meets the preset filtering conditions from multiple leaf query statements, the leaf query statement that is the difference in the difference operation can be excluded.

[0072] By applying the scheme of the embodiments of this specification, the size of the set of query results corresponding to multiple leaf query statements is obtained; the set of query results with the smallest size is selected from the set of query results corresponding to multiple leaf query statements as the target query result set, and the leaf query statement corresponding to the target query result set is used as the target leaf query statement. This reduces the amount of data when judging whether each target query result in the target query result set hits the leaf query statement to be queried, thereby improving the data query efficiency.

[0073] Step 408: Determine whether each target query result in the target query result set hits the leaf query statement to be queried, and obtain the determination result. The leaf query statement to be queried is a leaf query statement other than the target leaf query statement among multiple leaf query statements.

[0074] In one or more embodiments of this specification, a data query request is received, a structural analysis is performed on at least one joint query statement to determine multiple leaf query statements, and target leaf query statements that meet preset filtering conditions and target query result sets of target leaf query statements are selected from the multiple leaf query statements. Further, it can be determined whether each target query result in the target query result set hits the leaf query statement to be queried, and a judgment result is obtained.

[0075] It should be noted that when determining whether each target query result in the target query result set hits the leaf query statement to be queried, it is possible to check whether there are any results in each query result corresponding to the leaf query statement to be queried that are the same as the target query result. If so, it is determined that the target query result hits the leaf query statement to be queried; if not, it is determined that the target query result does not hit the leaf query statement to be queried.

[0076] In practical applications, there are multiple ways to determine whether each target query result in the target query result set matches the leaf query statement to be queried. The specific method to choose from depends on the actual situation, and the embodiments in this specification do not impose any limitations on this.

[0077] In the first possible implementation of this specification, one can directly traverse each target query result in the target query result set and determine whether each target query result matches the leaf query statement to be queried.

[0078] In the second possible implementation of this specification, the leaf query statements to be queried can be classified according to the retention / dismissal rules corresponding to the leaf query statements to be queried. The set of leaf query statements to be queried corresponding to each retention / dismissal rule after classification is used as the judgment unit to judge whether each target query result in the target query result set hits the leaf query statement to be queried, and the judgment result is obtained.

[0079] In the third possible implementation of this specification, it is possible to first determine whether each target query result in the target query result set matches a pending leaf query statement belonging to the same parent query as the target leaf query statement. Then, the parent query corresponding to the target leaf query statement is used as the updated target leaf query statement. The process of determining whether each target query result in the target query result set matches a pending leaf query statement belonging to the same parent query as the target leaf query statement is repeated until the target leaf query statement has no parent query, thus obtaining the determination result. Furthermore, to improve the determination efficiency, the query rule of the parent query corresponding to the target query statement can also be determined. If the query rule is a union query, pending leaf query statements belonging to the same parent query as the target query statement are skipped.

[0080] Step 410: Determine the target query result corresponding to the data query request based on the retention / rejection rules and results corresponding to the leaf query statement to be queried. The retention / rejection rules corresponding to the leaf query statement to be queried are determined based on the set operation type corresponding to the parent query of the leaf query statement to be queried.

[0081] In one or more embodiments of this specification, a data query request is received, a structural analysis is performed on at least one joint query statement to determine multiple leaf query statements, target leaf query statements that meet preset filtering conditions and a target query result set of the target leaf query statements are selected from the multiple leaf query statements, it is determined whether each target query result in the target query result set matches the leaf query statement to be queried, and after obtaining the determination result, the target query result corresponding to the data query request can be further determined according to the retention and rejection rules and determination result corresponding to the leaf query statement to be queried.

[0082] Specifically, the retain / delete rules are used to determine whether to delete target query results that match the leaf query statement to be queried from the target query result set. In practical applications, retain / delete rules include at least one of the intersection, difference, and union rules; the intersection rule indicates that if each target query result matches the leaf query statement to be queried, the target query result should be retained; the difference rule indicates that if each target query result matches the leaf query statement to be queried, the target query result should be deleted; and the union rule indicates that, based on the judgment result, the result index of each target query result should be determined.

[0083] The solution implemented in this specification allows for the filtering of target leaf query statements and target query result sets of target leaf query statements. By using the target query result set to check whether the leaf query statement to be queried is hit, the target query result corresponding to the data query request can be obtained. This eliminates the need to calculate intermediate sub-joint query statements, thereby controlling the ineffective performance and memory consumption of a large number of intermediate sub-joint query statements and improving the efficiency of data query.

[0084] In one optional embodiment of this specification, before determining the target query result corresponding to the data query request based on the retention / discard judgment rules and judgment results corresponding to the leaf query statement to be queried, the retention / discard judgment rules corresponding to the leaf query statement to be queried can be determined. The method for determining the retention / discard judgment rules corresponding to the leaf query statement to be queried may further include the following steps:

[0085] From at least one union query statement, determine the parent query of the leaf query statement to be queried;

[0086] Determine the set operation type corresponding to the leaf query statement based on the parent query of the leaf query statement to be queried;

[0087] Based on the set operation type, determine the retention / removal rules corresponding to the leaf query statement to be queried.

[0088] Specifically, the parent query of the leaf query statement can be either the parent query of the leaf query statement or the parent query of the leaf query statement. Set operations include intersection, union, and difference.

[0089] It should be noted that when determining the set operation type corresponding to the leaf query statement to be queried based on the parent query of the leaf query statement to be queried, you may only consider the set operation type corresponding to the parent query of the leaf query statement to be queried, or you may consider the set operation type of the parent query of the parent query of the leaf query statement to be queried. The specific choice should be made according to the actual situation, and the embodiments in this specification do not impose any limitations on this.

[0090] Furthermore, if the set operation type corresponding to the leaf query statement is only one, the retention / discard rule for the leaf query statement can be directly determined based on that set operation type. If the set operation type corresponding to the leaf query statement is multiple, the retention / discard rule for the leaf query statement can be determined by comprehensively considering all set operation types.

[0091] See Figure 5a , Figure 5a This diagram illustrates a join query statement in a data query method provided in one embodiment of this specification. See also: Figure 5aThe union query statement 1 includes sub-union query statement 1 and sub-union query statement 2. Sub-union query statement 1 includes sub-union query statement 3 and sub-union query statement 4. Sub-union query statement 3 includes leaf query statement 1 and leaf query statement 2. Sub-union query statement 4 includes leaf query statement 3 and leaf query statement 4. Sub-union query statement 2 includes leaf query statement 5 and leaf query statement 6. Taking leaf query statement 5 as an example, the parent query of leaf query statement 5 can be sub-union query statement 2. The set operation type for obtaining sub-union query statement 2 is intersection operation. Therefore, the set operation type for the leaf query statement to be queried is intersection operation, and the retention / removal rule for the leaf query statement to be queried is intersection rule. Taking leaf query statement 4 as an example, the parent query of leaf query statement 4 can be sub-join query statement 4, or it can be sub-join query statement 4 and sub-join query statement 1. Taking the parent query of leaf query statement 4 as sub-join query statement 4 and sub-join query statement 1 as an example, the set operation type corresponding to leaf query statement 4 is determined to be difference operation and union operation. Further, based on the operation characteristics of difference operation and union operation, the retention and removal judgment rule corresponding to the leaf query statement to be queried is determined to be the difference judgment rule.

[0092] The scheme implemented in this specification involves determining the parent query of the leaf query statement to be queried from at least one union query statement; determining the set operation type corresponding to the leaf query statement to be queried based on the parent query of the leaf query statement to be queried; and determining the retention / rejection rules corresponding to the leaf query statement to be queried based on the set operation type, so that the retention / rejection rules corresponding to the leaf query statement to be queried conform to the set operation type, thereby ensuring the accuracy of data query.

[0093] In the first possible implementation of this specification, determining the target query result corresponding to the data query request based on the retention / rejection rules and results corresponding to the leaf query statement to be queried may include the following steps:

[0094] When the decision rule is an intersection decision rule, the target query results that did not match the leaf query statements to be queried are deleted from the target query result set, and the target query results corresponding to the data query request are obtained.

[0095] For example, assuming the target query result set is [a, b, c], and the retention / removal rule is the intersection rule, we iterate through each target query result in the target query result set. If target query result a matches the leaf query statement 1, then target query result a is retained in the target query result set. If target query result b matches the leaf query statement 2, then target query result b is retained in the target query result set. If target query result c does not match the leaf query statement, then target query result c is deleted from the target query result set. Thus, the target query results corresponding to the data query request are a and b.

[0096] By applying the solution of the embodiments in this specification, when the retention / removal judgment rule is the intersection judgment rule, the target query results that did not match the leaf query statement to be queried are deleted from the target query result set, and the target query results corresponding to the data query request are obtained, thereby improving the accuracy of the target query results corresponding to the data query request.

[0097] In the second possible implementation of this specification, determining the target query result corresponding to the data query request based on the retention / rejection rules and results corresponding to the leaf query statement to be queried may include the following steps:

[0098] When the retention / removal rule is the difference rule, the target query result that hits the leaf query statement to be queried is deleted from the target query result set, and the target query result corresponding to the data query request is obtained.

[0099] For example, assuming the target query result set is [a, b, c], and the retention / removal rule is the difference rule, we iterate through each target query result in the target query result set. If target query result a matches the leaf query statement 1, then target query result a is deleted from the target query result set. If target query result b matches the leaf query statement 2, then target query result b is deleted from the target query result set. If target query result c does not match the leaf query statement, then target query result c is retained in the target query result set. Thus, the target query result corresponding to the data query request is c.

[0100] By applying the solution of the embodiments in this specification, when the retention / removal judgment rule is the difference set judgment rule, the target query result that hits the leaf query statement to be queried is deleted from the target query result set, and the target query result corresponding to the data query request is obtained, thereby improving the accuracy of the target query result corresponding to the data query request.

[0101] In the third possible implementation of this specification, determining the target query result corresponding to the data query request based on the retention / rejection judgment rules and judgment results corresponding to the leaf query statement to be queried may include the following steps:

[0102] When the decision rule for retaining or discarding is a union decision rule, the result index of each target query result is determined based on the number of leaf query statements that the target query result in the target query result set hits.

[0103] In the embodiments of this specification, when the retention / discard decision rule is a union decision rule, the target query result set and the query result set corresponding to the leaf query statement to be queried can be merged to obtain a merged query result set. Then, the merged query result set is deduplicated to obtain the target query result corresponding to the data query request. Furthermore, when the retention / discard decision rule is a union decision rule, the target query result corresponding to the data query request can be a result indicator of the target query result.

[0104] In practical applications, there are multiple ways to determine the result index of each target query result based on the number of leaf queries that each target query result in the target query result set matches. The specific method chosen depends on the actual situation, and this specification does not impose any limitations on this approach. One possible implementation of this specification is to sum the number of leaf queries that each target query result matches to determine the result index of each target query result. Another possible implementation of this specification is: Result Index = Number of leaf queries that the target query result matches * (Total number of matched leaf queries / Number of leaf queries in the union statement).

[0105] For example, suppose a matching leaf query is scored as 1, where the query name = "XXXX", age = "18", or address = "YYYY". Document (target query result) 1 only meets the condition name = "XXXX", and its score is 1 = 1. In this case, the final score of document 1 is 1 * (1 / 3). Document 2 meets both conditions: age = 18 and address = "YYYY". The score obtained from the sub-condition age = 18 is 2, and the score obtained from the sub-condition address = "YYYY" is 3. In this case, the final score of document 2 is (2 + 3) * (2 / 3).

[0106] By applying the solution of the embodiments in this specification, when the retention / rejection judgment rule is a union judgment rule, the result index of each target query result is determined based on the number of leaf query statements to be queried in each target query result set, thereby achieving efficient and accurate determination of the result index of the target query result.

[0107] Furthermore, after determining the result metrics for each target query result based on the number of leaf query statements matched by each target query result in the target query result set, the following steps may also be included:

[0108] Based on the result metrics of each target query result, sort the target query results and display them according to the sorting.

[0109] For example, suppose the result metric a of target query result a is 3, the result metric b of target query result b is 8, and the result metric c of target query result c is 4. Based on the result metrics of each target query result, the target query results are sorted, and target query result b is ranked before target query result c, and target query result c is ranked before target query result a. Therefore, when displaying the target query results on the client, target query result b is displayed first, then target query result c, and finally target query result a.

[0110] The solution implemented in this specification sorts the target query results according to the result indicators of each target query result, and displays the target query results according to the sorting. This achieves the goal of prioritizing the display of target query results with higher indicators, meeting viewing needs and improving user experience.

[0111] In one optional embodiment of this specification, the set of leaf query statements to be queried corresponding to each classified retention / rejection judgment rule is used as the judgment unit. The judgment result is obtained by determining whether each target query result in the target query result set matches the leaf query statement to be queried. That is, the judgment result obtained by determining whether each target query result in the target query result set matches the leaf query statement to be queried may include the following steps:

[0112] Based on the retention / discard rules corresponding to the leaf query statements to be queried, the leaf query statements to be queried are classified to obtain the set of leaf query statements to be queried corresponding to the retention / discard rules.

[0113] For any set of leaf queries to be queried, determine whether each target query result in the target query result set matches the leaf query statement to be queried in the set of leaf queries to be queried, and obtain the first determination result;

[0114] Based on the retention / removal rules and results corresponding to the leaf query statement, determining the target query result for the data query request can include the following steps:

[0115] Based on the first judgment result and the retention / removal judgment rule corresponding to the set of leaf query statements to be queried, the target query result set is updated to obtain the updated target query result set. Then, the step of judging whether each target query result in the target query result set matches the leaf query statement to be queried in the set of leaf query statements to be queried is returned to obtain the first judgment result. This process continues until the set of leaf query statements to be queried corresponding to the retention / removal judgment rule is traversed and the target query result corresponding to the data query request is obtained.

[0116] For example, based on the retention / rejection rules corresponding to the leaf query statements to be queried, the leaf query statements to be queried can be classified into two sets: set A corresponding to the intersection rule and set B corresponding to the difference rule.

[0117] For the set of leaf query statements to be queried, determine whether each target query statement in the target query result set [a,b,c] matches the leaf query statement to be queried in the set of leaf query statements to be queried. If the first judgment result is "target query result a matches, target query result b matches, target query result c does not match", then update the target query result set according to the first judgment result and the intersection judgment rule to obtain the updated target query result set as [a,b].

[0118] For the set of leaf query statements to be queried, determine whether each target query result in the updated target query result set [a, b] matches the leaf query statement to be queried in the set of leaf query statements to be queried. If the first judgment result is "target query result a matches, target query result b does not match", then update the target query result set according to the first judgment result and the difference set judgment rule to obtain the updated target query result set [b]. At this time, the leaf query statement set to be queried corresponding to the retention / removal judgment rule is traversed, and the target query result corresponding to the data query request is obtained as [b].

[0119] The scheme implemented in this specification classifies the leaf query statements according to the retention / discard rules corresponding to the leaf query statements to be queried, thereby obtaining a set of leaf query statements to be queried corresponding to the retention / discard rules. Taking the set of leaf query statements to be queried as a unit, it is determined whether each target query result in the target query result set matches the leaf query statement to be queried in the set of leaf query statements to be queried, which improves the efficiency of data query. Furthermore, after the set of leaf query statements to be queried corresponding to the retention / discard rules has been traversed, the target query result corresponding to the data query request is obtained, ensuring the accuracy of data query.

[0120] In another optional embodiment of this specification, the above-mentioned determination of whether each target query result in the target query result set matches the leaf query statement to be queried, and obtaining the determination result, may include the following steps:

[0121] Treat the target leaf query statement as the currently queried statement;

[0122] Determine whether the parent query corresponding to the currently queried statement is a union query and meets the preset union query skip condition;

[0123] If so, the parent query corresponding to the currently queried statement is taken as the updated currently queried statement, and the process returns to the step of determining whether the parent query corresponding to the currently queried statement is a union query and meets the preset union query skip condition.

[0124] If not, other leaf queries that belong to the same parent query as the currently queried statement will be used as the current leaf query to be queried.

[0125] Determine whether each target query result in the target query result set matches the current leaf query statement to obtain the second determination result.

[0126] Specifically, the preset union query skipping condition can be to skip all leaf query statements to be queried in the union query, or it can be to skip leaf query statements to be queried whose set size exceeds a preset threshold. The specific choice depends on the actual situation, and this specification does not limit it in any way.

[0127] By applying the solution of the embodiments in this specification, by determining whether the parent query corresponding to the currently queried statement is a union query and satisfies the preset union query skip condition, if so, the parent query corresponding to the currently queried statement is used as the updated currently queried statement, thereby eliminating the need to run leaf query statements that meet the preset union query skip condition and reducing memory consumption.

[0128] Furthermore, determining the target query result corresponding to the data query request based on the retention / rejection rules and results corresponding to the leaf query statement to be queried may include the following steps:

[0129] Based on the second judgment result and the retention / removal judgment rule corresponding to the current leaf query statement to be queried, the target query result set is updated to obtain the updated target query result set;

[0130] The parent query corresponding to the currently queried statement is used as the updated currently queried statement, and the process of determining whether the parent query corresponding to the currently queried statement is a union query and meets the preset union query skip condition is repeated until the currently queried statement has no parent query, and the target query result corresponding to the data query request is obtained.

[0131] For example, see Figure 5b , Figure 5b This diagram illustrates a join query statement in another data query method provided in one embodiment of this specification. See also Figure 5b The join query statement 1 includes subjoin query statement 1 and leaf query statement 4. Subjoin query statement 1 includes subjoin query statement 2 and leaf query statement 3. Subjoin query statement 2 includes leaf query statement 1 and leaf query statement 2. The set operation type between leaf query statement 1 and leaf query statement 2 is intersection query. The set operation type between subjoin query statement 2 and leaf query statement 3 is difference query. The set operation type between subjoin query statement 1 and leaf query statement 4 is union query.

[0132] like Figure 5b As shown, assuming the target leaf query statement is leaf query statement 2, leaf query statement 2 is taken as the currently queried statement. It is determined that the parent query corresponding to leaf query statement 2 is an intersection query, not a union query. Therefore, leaf query statement 1, which belongs to the same parent query as leaf query statement 2, is taken as the current leaf query statement to be queried. It is then determined whether each target query result in the target query result set matches leaf query statement 1, obtaining a second determination result. Based on the second determination result and the retention / removal rules corresponding to the currently queried leaf query statement, the target query result set is updated to obtain the updated target query result set. The parent query "sub-join query statement 2" corresponding to leaf query statement 2 is taken as the updated currently queried statement. It is determined that the parent query corresponding to sub-join query statement 2 is a difference query, not a union query. Therefore, leaf query statement 3, which belongs to the same parent query as sub-join query statement 2, is taken as the current leaf query statement to be queried. It is then determined whether each target query result in the target query result set matches leaf query statement 3, obtaining a second determination result. Based on the second determination result and the retention / removal rules corresponding to the currently queried leaf query statement, the target query result set is updated to obtain the updated target query result set. The parent query "sub-join query statement 1" corresponding to sub-join query statement 2 is taken as the updated currently queried statement. It is determined that the parent query corresponding to sub-join query statement 1 is a union query and satisfies the preset union query skipping condition. Therefore, the parent query "join query statement 1" corresponding to sub-join query statement 1 is taken as the updated currently queried statement. At this point, the currently queried statement "join query statement 1" does not have a parent query, ending the update of the target query result set. The updated target query result set is taken as the target query result corresponding to the data query request.

[0133] By applying the solutions in the embodiments of this specification, the target query result corresponding to the data query request can be obtained when the current query statement does not have a parent query, thus ensuring the accuracy of the data query.

[0134] The following is in conjunction with the appendix Figure 6 This document further explains the data query methods provided in this instruction manual. Figure 6 The present specification illustrates a flowchart of a data query method according to an embodiment, which includes the following steps:

[0135] Step 602: Receive a data query request, wherein the data query request includes at least one union query statement.

[0136] Step 604: Perform structural analysis on at least one union query statement to identify multiple leaf query statements.

[0137] Step 606: Obtain the size of the set of query results corresponding to multiple leaf query statements.

[0138] Step 608: Select the query result set with the smallest size from the query result sets corresponding to multiple leaf query statements as the target query result set, and use the leaf query statement corresponding to the target query result set as the target leaf query statement.

[0139] Step 610: Determine whether each target query result in the target query result set hits the leaf query statement to be queried, and obtain the determination result. The leaf query statement to be queried is a leaf query statement other than the target leaf query statement among multiple leaf query statements.

[0140] Step 612: If the decision rule is an intersection decision rule, delete the target query results that did not match the leaf query statements to be queried from the target query result set, and obtain the target query results corresponding to the data query request.

[0141] Step 614: If the retention / removal rule is the difference set rule, delete the target query results that match the leaf query statement to be queried from the target query result set, and obtain the target query results corresponding to the data query request.

[0142] Step 616: When the decision rule is a union decision rule, determine the result index of each target query result based on the number of leaf query statements that each target query result in the target query result set hits.

[0143] Step 618: Sort the target query results according to the result indicators of each target query result, and display the target query results according to the sorting.

[0144] It should be noted that the implementation methods of steps 602-618 are the same as those of steps 402-410 above, and will not be described again in the embodiments of this specification.

[0145] The solution implemented in this specification involves filtering the target leaf query statement at the smallest granularity and the target query result set of the target leaf query statement. By using the target query result set with the smallest set size to check whether the leaf query statement to be queried is hit, the target query result corresponding to the data query request can be obtained. There is no need to calculate intermediate sub-joint query statements, thereby controlling the invalid performance and memory consumption of a large number of intermediate sub-joint query statements and improving the efficiency of data query.

[0146] See Figure 7 , Figure 7 A flowchart illustrating the processing steps of another data query method provided in one embodiment of this specification is shown. Figure 7 As shown, structural analysis of the joint query statement reveals that it comprises sub-joint query statement 1 and leaf query statement 2. Structural analysis of sub-joint query statement 1 further reveals that it comprises leaf query statement 1-1 and leaf query statement 1-2. The query result set corresponding to leaf query statement 1-1 is obtained as sub-document result set 1-1, the query result set corresponding to leaf query statement 1-2 is obtained as sub-document result set 1-2, and the query result set corresponding to leaf query statement 2 is obtained as sub-document result set 2. From sub-document result set 1-1, sub-document result set 1-2, and sub-document result set 2, the smallest sub-document result set 2 is selected as the target query result set. Using the intersection, union, and difference rules, a reverse check is performed to see if each target query result in the target query result set matches sub-document result set 1-1 and sub-document result set 1-2, thus obtaining the final document result set.

[0147] In this embodiment, the method of iteratively minimizing the target query result set is adopted. This involves obtaining the smallest granularity leaf query statement that can generate the query result set, and filtering from multiple leaf query statements to select the smallest target query result set. The smallest target query result set is then used to check whether each target query result in the target query result set matches the leaf query statement to be queried, obtaining a judgment result. Based on the judgment result and the retention / discard rules, the target query result set is continuously iterated and updated to obtain the final target query result corresponding to the data query request. Specifically, the following steps are included:

[0148] Decompose at least one join query statement into leaf query statements with the smallest granularity of the query result set;

[0149] Retrieve the result set of the leaf query statement with the smallest granularity;

[0150] From the result set of the leaf query, select the smallest target result set as the first iteration result set, and perform different iterations according to the retention / rejection rules:

[0151] Intersection judgment rule: Traverse each target query result in the target query result set, and check in reverse the leaf query statement to be queried for intersection condition operation whether the target query result matches the leaf query statement to be queried. If it matches, keep the target query result in the target query result set; if it does not match, delete the target query result from the target query result set.

[0152] Union judgment rule: Traverse each target query result in the target query result set, and check whether the target query result matches the leaf query statement to be queried in the leaf query statement to be queried for union condition operation. If it matches, count the number of leaf queries that the target query result matches, generate result indicators, and use them for subsequent scoring.

[0153] Difference judgment rule: Traverse each target query result in the target query result set, and check in reverse the leaf query statement to be queried in the difference condition operation to see if the target query result matches the leaf query statement to be queried. If it matches, delete the target query result from the target query result set; if it does not match, keep the target query result in the target query result set.

[0154] The solution implemented in this specification decomposes the join query statement and uses the smallest possible target query result set for iteration. The target query result set with the smallest possible set is then used to check whether it hits any leaf queries other than the target leaf query statement among multiple leaf queries. The target query result set is continuously updated iteratively to obtain the final result set. This eliminates the need to calculate intermediate sub-join queries, thereby controlling the ineffective performance and memory consumption of a large number of intermediate sub-join queries and improving the efficiency of data querying.

[0155] See Figure 8 , Figure 8 This diagram illustrates a data query interface according to an embodiment of this specification. The data query interface is divided into a data query request input interface and a data query result display interface. The data query request input interface includes a data query request input box, an "OK" control, and a "Cancel" control. The data query result display interface includes a data query result display box.

[0156] The user enters a data query request, including at least one compound query statement, in the data query request input box displayed on the client side. After clicking the "OK" control, the server receives the data query request from the client, performs structural analysis on the at least one compound query statement, identifies multiple leaf query statements, and filters out target leaf query statements that meet preset filtering conditions, along with the target query result set for those target leaf query statements. The server then determines whether each target query result in the target query result set matches the requested leaf query statement, obtains the judgment result, and, based on the retention / retention rules corresponding to the requested leaf query statement and the judgment result, determines the target query result corresponding to the data query request and sends the target query result to the client. The client displays the target query result in the data query result display box.

[0157] In practical applications, users can interact with controls in various ways, including clicking, double-clicking, touching, hovering, swiping, long-pressing, voice control, or shaking. The specific method chosen depends on the actual situation, and this specification does not impose any limitations on this.

[0158] Corresponding to the above method embodiments, this specification also provides embodiments of a data query device. Figure 9 A schematic diagram of a data query device according to one embodiment of this specification is shown. Figure 9 As shown, the device includes:

[0159] The receiving module 902 is configured to receive a data query request, wherein the data query request includes at least one union query statement;

[0160] Analysis module 904 is configured to perform structural analysis on at least one union query statement to identify multiple leaf query statements;

[0161] The filtering module 906 is configured to filter target leaf query statements and target query result sets of target leaf query statements from multiple leaf query statements that meet preset filtering conditions.

[0162] The judgment module 908 is configured to judge whether each target query result in the target query result set hits the leaf query statement to be queried, and obtain the judgment result. The leaf query statement to be queried is a leaf query statement other than the target leaf query statement among multiple leaf query statements.

[0163] The determination module 910 is configured to determine the target query result corresponding to the data query request based on the retention / rejection judgment rules and judgment results corresponding to the leaf query statement to be queried. The retention / rejection judgment rules corresponding to the leaf query statement to be queried are determined based on the set operation type corresponding to the parent query of the leaf query statement to be queried.

[0164] Optionally, the retention / rejection rules include at least one of the intersection rules, difference rules, and union rules; the intersection rule is used to indicate that if each target query result hits the leaf query statement to be queried, the target query result is retained; the difference rule is used to indicate that if each target query result hits the leaf query statement to be queried, the target query result is deleted; and the union rule is used to indicate that the result index of each target query result is determined according to the judgment result.

[0165] Optionally, the determining module 910 is further configured to: when the retention / discard decision rule is an intersection decision rule, delete the target query results that did not hit the leaf query statements to be queried from the target query result set, and obtain the target query results corresponding to the data query request; when the retention / discard decision rule is a difference decision rule, delete the target query results that hit the leaf query statements to be queried from the target query result set, and obtain the target query results corresponding to the data query request; when the retention / discard decision rule is a union decision rule, determine the result index of each target query result based on the number of leaf query statements to be queried that each target query result in the target query result set hits.

[0166] Optionally, the device further includes a sorting module configured to sort the target query results according to the result metrics of each target query result, and display the target query results according to the sorting.

[0167] Optionally, the filtering module 906 is further configured to obtain the set size of the query result set corresponding to multiple leaf query statements; select the query result set with the smallest set size from the query result sets corresponding to multiple leaf query statements as the target query result set, and take the leaf query statement corresponding to the target query result set as the target leaf query statement.

[0168] Optionally, the device further includes: a rule determination module, configured to determine the parent query of the leaf query statement to be queried from at least one joint query statement; determine the set operation type corresponding to the leaf query statement to be queried based on the parent query of the leaf query statement to be queried; and determine the retention / rejection judgment rule corresponding to the leaf query statement to be queried based on the set operation type.

[0169] Optionally, the judgment module 908 is further configured to classify the leaf query statements to be queried according to the retention / discard judgment rules corresponding to the leaf query statements to be queried, and obtain a set of leaf query statements to be queried corresponding to the retention / discard judgment rules; for any set of leaf query statements to be queried, determine whether each target query result in the target query result set matches the leaf query statements to be queried in the set of leaf query statements to be queried, and obtain a first judgment result; the determination module 910 is further configured to update the target query result set according to the first judgment result and the retention / discard judgment rules corresponding to the set of leaf query statements to be queried, obtain an updated target query result set, and return to the step of determining whether each target query result in the target query result set matches the leaf query statements to be queried in the set of leaf query statements to be queried, and obtain the first judgment result, until the set of leaf query statements to be queried corresponding to the retention / discard judgment rules is traversed and the target query result corresponding to the data query request is obtained.

[0170] Optionally, the judgment module 908 is further configured to: take the target leaf query statement as the currently queried statement; determine whether the parent query corresponding to the currently queried statement is a union query and satisfies the preset union query skip condition; if yes, take the parent query corresponding to the currently queried statement as the updated currently queried statement, and return to the step of determining whether the parent query corresponding to the currently queried statement is a union query and satisfies the preset union query skip condition; if no, take other leaf query statements belonging to the same parent query as the currently queried statement as the currently to be queried leaf query statement; determine whether each target query result in the target query result set hits the currently to be queried leaf query statement, and obtain the second judgment result.

[0171] Optionally, the determining module 910 is further configured to update the target query result set according to the second judgment result and the retention / removal judgment rule corresponding to the current leaf query statement to be queried, and obtain the updated target query result set; take the parent query corresponding to the current query statement as the updated current query statement, and return to the step of judging whether the parent query corresponding to the current query statement is a union query and meets the preset union query skipping condition, until the current query statement does not have a parent query, and obtain the target query result corresponding to the data query request.

[0172] The solution implemented in this specification allows for the filtering of target leaf query statements and target query result sets of target leaf query statements. By using the target query result set to check whether the leaf query statement to be queried is hit, the target query result corresponding to the data query request can be obtained. This eliminates the need to calculate intermediate sub-joint query statements, thereby controlling the ineffective performance and memory consumption of a large number of intermediate sub-joint query statements and improving the efficiency of data query.

[0173] The above is an illustrative scheme of a data query device according to this embodiment. It should be noted that the technical solution of this data query device and the technical solution of the data query method described above belong to the same concept. For details not described in detail in the technical solution of the data query device, please refer to the description of the technical solution of the data query method described above.

[0174] Figure 10 This specification illustrates a structural block diagram of a computing device according to one embodiment. The components of the computing device 1000 include, but are not limited to, a memory 1010 and a processor 1020. The processor 1020 is connected to the memory 1010 via a bus 1030, and a database 1050 is used to store data.

[0175] The computing device 1000 also includes an access device 1040, which enables the computing device 1000 to communicate via one or more networks 1060. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 1040 may include one or more of any type of wired or wireless network interface (e.g., Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (World Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0176] In one embodiment of this specification, the above-described components of the computing device 1000 and Figure 10 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 10 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0177] The computing device 1000 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 1000 can also be a mobile or stationary server.

[0178] The processor 1020 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above-described data query method.

[0179] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the data query method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the data query method described above.

[0180] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the above-described data query method.

[0181] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the data query method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the data query method described above.

[0182] An embodiment of this specification also provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described data query method.

[0183] The above is an illustrative example of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the data query method described above belong to the same concept. Details not described in detail in the technical solution of the computer program can be found in the description of the technical solution of the data query method described above.

[0184] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0185] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0186] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0187] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0188] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A data query method, comprising: Receive a data query request, wherein the data query request includes at least one union query statement; Perform structural analysis on the at least one joined query statement to identify multiple leaf query statements; From the plurality of leaf query statements, target leaf query statements that meet preset filtering conditions and the target query result set of the target leaf query statements are filtered out, wherein the preset filtering conditions include the smallest query result size corresponding to the leaf query statement; Determine whether each target query result in the target query result set matches the leaf query statement to be queried, and obtain a determination result. The leaf query statement to be queried is a leaf query statement other than the target leaf query statement among the plurality of leaf query statements. Determining whether each target query result in the target query result set matches the leaf query statement to be queried includes: determining whether there is a result that is the same as the target query result among the query results corresponding to the leaf query statement to be queried. Based on the retention / discard decision rules corresponding to the leaf query statement to be queried and the decision results, the target query result corresponding to the data query request is determined, wherein the retention / discard decision rules corresponding to the leaf query statement to be queried are determined according to the set operation type corresponding to the parent query of the leaf query statement to be queried.

2. The method according to claim 1, wherein the decision rule for keeping or discarding includes at least one of the following: intersection decision rule, difference decision rule, and union decision rule; The intersection judgment rule is used to indicate that if each target query result matches the leaf query statement to be queried, the target query result is retained. The difference set judgment rule is used to indicate that if each target query result matches the leaf query statement to be queried, the target query result will be deleted. The union judgment rule is used to indicate the result index of each target query result based on the judgment result.

3. The method according to claim 1, wherein determining the target query result corresponding to the data query request based on the retention / rejection judgment rule corresponding to the leaf query statement to be queried and the judgment result includes: When the retention / discard decision rule is an intersection decision rule, the target query results that did not match the leaf query statement to be queried are deleted from the target query result set to obtain the target query result corresponding to the data query request. When the retention / deletion rule is the difference set rule, the target query result that hits the leaf query statement to be queried is deleted from the target query result set, and the target query result corresponding to the data query request is obtained. When the retention / rejection rule is a union rule, the result index of each target query result is determined based on the number of times each target query result in the target query result set matches the leaf query statement to be queried.

4. The method according to claim 3, after determining the result index of each target query result based on the number of times each target query result in the target query result set matches the leaf query statement to be queried, it further includes: Based on the result indicators of each target query result, the target query results are sorted, and the target query results are displayed according to the sorting.

5. The method according to claim 1, wherein filtering target leaf query statements and target query result sets of the target leaf query statements from the plurality of leaf query statements that meet preset filtering conditions includes: Obtain the size of the set of query results corresponding to the multiple leaf query statements; Select the query result set with the smallest size from the query result sets corresponding to the plurality of leaf query statements as the target query result set, and use the leaf query statement corresponding to the target query result set as the target leaf query statement.

6. The method according to claim 1, before determining the target query result corresponding to the data query request based on the retention / rejection judgment rule corresponding to the leaf query statement to be queried and the judgment result, further comprising: From the at least one join query statement, determine the parent query of the leaf query statement to be queried; Based on the parent query of the leaf query statement to be queried, determine the set operation type corresponding to the leaf query statement to be queried; Based on the set operation type, determine the retention / removal rules corresponding to the leaf query statement to be queried.

7. The method according to claim 1, wherein determining whether there is a result identical to the target query result among the query results corresponding to the leaf query statement to be queried, and obtaining the determination result, includes: Based on the retention / discard rules corresponding to the leaf query statements to be queried, the leaf query statements to be queried are classified to obtain the set of leaf query statements to be queried corresponding to the retention / discard rules. For any set of leaf query statements to be queried, determine whether each target query result in the target query result set matches the leaf query statement to be queried in the set of leaf query statements to be queried, and obtain the first determination result; The step of determining the target query result corresponding to the data query request based on the retention / rejection judgment rule corresponding to the leaf query statement to be queried and the judgment result includes: Based on the first judgment result and the retention / discard judgment rule corresponding to the set of leaf query statements to be queried, the target query result set is updated to obtain the updated target query result set. Then, the step of judging whether each target query result in the target query result set matches the leaf query statement to be queried in the set of leaf query statements to be queried is returned to execute, and the first judgment result is obtained. This process continues until the set of leaf query statements to be queried corresponding to the retention / discard judgment rule is traversed, and the target query result corresponding to the data query request is obtained.

8. The method according to claim 1, wherein determining whether there is a result identical to the target query result among the query results corresponding to the leaf query statement to be queried, and obtaining the determination result, includes: The target leaf query statement is treated as the currently queried statement; Determine whether the parent query corresponding to the currently queried statement is a union query and satisfies the preset union query skip condition; If so, the parent query corresponding to the currently queried statement is taken as the updated currently queried statement, and the process returns to the step of determining whether the parent query corresponding to the currently queried statement is a union query and satisfies the preset union query skip condition. If not, other leaf query statements that belong to the same parent query as the currently queried statement will be used as the current leaf query statement to be queried. Determine whether each target query result in the target query result set matches the current leaf query statement to be queried, and obtain a second determination result.

9. The method according to claim 8, wherein determining the target query result corresponding to the data query request based on the retention / rejection judgment rule corresponding to the leaf query statement to be queried and the judgment result includes: Based on the second judgment result and the retention / removal judgment rule corresponding to the current leaf query statement to be queried, the target query result set is updated to obtain the updated target query result set. The parent query corresponding to the currently queried statement is used as the updated currently queried statement, and the step of determining whether the parent query corresponding to the currently queried statement is a union query and satisfies the preset union query skip condition is returned until the currently queried statement has no parent query, and the target query result corresponding to the data query request is obtained.

10. A data query system, comprising a client and a server; The client is used to send a data query request to the server, wherein... The data query request includes at least one union query statement; The server is configured to process the data query request according to the data query method as described in any one of claims 1 to 9.

11. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the data query method according to any one of claims 1 to 9.

12. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the data query method according to any one of claims 1 to 9.

13. A computer program product, characterized in that, It includes computer instructions that, when executed by a processor, implement the steps of the data query method according to any one of claims 1 to 9.