Search

CN-116303544-B - Data query method, system and device

CN116303544BCN 116303544 BCN116303544 BCN 116303544BCN-116303544-B

Abstract

The embodiment of the specification provides a data query method, a data query system and a data query device, wherein the data query method comprises the steps of receiving a data query request, carrying out structural analysis on at least one joint query statement to determine a plurality of leaf query statements, screening target leaf query statements meeting preset screening conditions and target query result sets of the target leaf query statements from the plurality of leaf query statements, judging whether each target query result in the target query result sets hits a leaf query statement to be queried to obtain a judgment result, and determining the target query result corresponding to the data query request according to a leave judgment rule and the judgment result corresponding to the leaf query statement to be queried. Whether the target query result hits the leaf query statement to be queried is reversely checked by utilizing the target query result set, so that the target query result is obtained without calculating intermediate sub-joint query statements, thereby controlling the invalid performance and the memory loss of a large number of intermediate sub-joint query statements and improving the data query efficiency.

Inventors

  • ZHENG XIAOYIN

Assignees

  • 阿里云计算有限公司

Dates

Publication Date
20260512
Application Date
20230331

Claims (13)

  1. 1. A data query method, comprising: Receiving a data query request, wherein the data query request comprises 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; Screening target leaf query sentences and target query result sets of the target leaf query sentences which meet preset screening conditions from the plurality of leaf query sentences, wherein the preset screening conditions comprise minimum query result scales corresponding to the leaf query sentences; Judging whether each target query result in the target query result set hits a leaf query statement to be queried or not to obtain a judging result, wherein the leaf query statement to be queried is a leaf query statement other than the target leaf query statement in the plurality of leaf query statements, and judging whether each target query result in the target query result set hits the leaf query statement to be queried or not comprises judging whether each query result corresponding to the leaf query statement to be queried has the same result as the target query result or not; And determining a target query result corresponding to the data query request according to the leave-out judging rule corresponding to the leaf query statement to be queried and the judging result, wherein the leave-out judging rule corresponding to the leaf query statement to be queried is determined according to the set operation type corresponding to the superior query of the leaf query statement to be queried.
  2. 2. The method of claim 1, the leave-out decision rule comprising at least one of an intersection decision rule, a difference set decision rule, and a union decision rule; the intersection judgment rule is used for indicating that the target query result is reserved under the condition that each target query result hits the leaf query statement to be queried; The difference set judging rule is used for indicating that the target query result is deleted under the condition that each target query result hits the leaf query statement to be queried; And the union judgment rule is used for indicating and determining the result index of each target query result according to the judgment result.
  3. 3. The method according to claim 1, wherein the determining, according to the leave-out determination rule corresponding to the leaf query statement to be queried and the determination result, the target query result corresponding to the data query request includes: deleting target query results which miss the leaf query statement to be queried from the target query result set under the condition that the leave determination rule is an intersection determination rule, and obtaining target query results corresponding to the data query request; deleting the target query result hitting the leaf query statement to be queried from the target query result set under the condition that the leave determination rule is a difference set determination rule, and obtaining a target query result corresponding to the data query request; and under the condition that the leave-out judging rule is a union judging rule, determining the result index of each target query result according to the number of hit of each target query result in the target query result set on the leaf query statement to be queried.
  4. 4. The method according to claim 3, wherein after determining the result index of each target query result according to the number of hits on the leaf query statement to be queried by each target query result in the target query result set, the method further comprises: and sequencing the target query results according to the result indexes of the target query results, and displaying the target query results according to the sequencing.
  5. 5. The method of claim 1, wherein the screening, from the plurality of leaf query sentences, the target leaf query sentences and the target query result set of the target leaf query sentences that meet a preset screening condition comprises: Acquiring the set scale of the query result set corresponding to the plurality of leaf query sentences; Selecting a query result set with the smallest set scale from query result sets corresponding to the leaf query sentences as the target query result set, and taking the leaf query sentences corresponding to the target query result set as the target leaf query sentences.
  6. 6. The method according to claim 1, wherein before determining the target query result corresponding to the data query request according to the leave determination rule corresponding to the leaf query statement to be queried and the determination result, the method further comprises: determining the superior query of the leaf query statement to be queried from the at least one joint query statement; Determining a set operation type corresponding to the leaf query statement to be queried according to the superior query of the leaf query statement to be queried; And determining a leave-out judgment rule corresponding to the leaf query statement to be queried according to the set operation type.
  7. 7. The method of claim 1, wherein the determining whether the query results corresponding to the leaf query statement to be queried have the same result as the target query result, to obtain the determination result, includes: Classifying the leaf query sentences to be queried according to the leave-out judging rules corresponding to the leaf query sentences to be queried to obtain leaf query sentence sets to be queried corresponding to the leave-out judging rules; Judging whether each target query result in the target query result set hits a leaf query statement to be queried of the leaf query statement set to be queried according to any leaf query statement set to be queried, and obtaining a first judgment result; The determining the target query result corresponding to the data query request according to the leave-out judgment rule corresponding to the leaf query statement to be queried and the judgment result comprises the following steps: Updating the target query result set according to the first judgment result and a leave-out judgment rule corresponding to the leave-out judgment statement set to be queried, obtaining an updated target query result set, and returning to execute the step of judging whether each target query result in the target query result set hits the leave-out judgment statement of the leave-out judgment statement set to be queried, obtaining a first judgment result until the leave-out judgment rule corresponding to the leave-out judgment rule is traversed, and obtaining a target query result corresponding to the data query request.
  8. 8. The method of claim 1, wherein the determining whether the query results corresponding to the leaf query statement to be queried have the same result as the target query result, to obtain the determination result, includes: taking the target leaf query statement as a current queried statement; Judging whether the parent query corresponding to the current queried statement is a union query or not and meeting a preset union query skip condition; If so, taking the father query corresponding to the current queried statement as the updated current queried statement, and returning to execute the step of judging whether the father query corresponding to the current queried statement is the union query or not and meeting the preset union query skip condition; If not, taking other leaf query sentences belonging to the same father query as the current leaf query sentence to be queried; and judging whether each target query result in the target query result set hits the current leaf query statement to be queried or not, and obtaining a second judgment result.
  9. 9. The method of claim 8, wherein the determining, according to the leave determination rule and the determination result corresponding to the leaf query statement to be queried, the target query result corresponding to the data query request includes: Updating the target query result set according to the second judgment result and the leaving judgment rule corresponding to the current leaf query statement to be queried to obtain an updated target query result set; And taking the parent query corresponding to the current queried statement as an updated current queried statement, and returning to execute the step of judging whether the parent query corresponding to the current queried statement is a union query and meeting a preset union query skip condition until the current queried statement does not have the parent query, so as to obtain a target query result corresponding to the data query request.
  10. 10. A data query system comprises a client and a server; the client is used for sending a data query request to the server, wherein the data query request comprises at least one joint query statement; The server is configured to process the data query request according to the data query method according to any one of claims 1 to 9.
  11. 11. A computing device, comprising: A memory and a processor; The memory is configured to store computer executable instructions, and the processor is configured to execute the computer executable instructions, which when executed by the processor, implement the steps of the data query method of any one of claims 1 to 9.
  12. 12. A computer readable storage medium storing computer executable instructions which when executed by a processor perform the steps of the data querying method according to any of claims 1 to 9.
  13. 13. A computer program product comprising computer instructions which, when executed by a processor, implement the steps of the data querying method as claimed in any one of claims 1 to 9.

Description

Data query method, system and device Technical Field The embodiment of the specification relates to the technical field of computers, in particular to a data query method. One or more embodiments of the present specification relate to a data query system, a data query apparatus, a computing device, a computer-readable storage medium, and a computer program. Background With the continuous development of computer technology, the data volume generated by enterprises or individual users is increased explosively, and how to efficiently and accurately perform data query in mass data gradually becomes a research key point. At present, data query is generally performed by using multi-condition joint query sentences, namely, sub-joint query sentences in the joint query sentences are operated to obtain sub-joint document result sets, and then the sub-joint document result sets and other sub-document result sets are operated to obtain query results. However, when the number of results hit by the query statement is excessive and the joint query statement is nested in the sub-query, the query efficiency of the above scheme is also reduced. Therefore, there is a need for an efficient data query scheme. Disclosure of Invention In view of this, the embodiments of the present disclosure provide a data query method. One or more embodiments of the present specification also relate to a data query system, a data query device, a computing device, a computer-readable storage medium, and a computer program, which solve the technical drawbacks of the prior art. According to a first aspect of embodiments of the present disclosure, a data query method is provided, which includes receiving a data query request, where 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, screening target leaf query statements and target query result sets of the target leaf query statements, which meet a preset screening condition, from the plurality of leaf query statements, determining whether each target query result in the target query result set hits a leaf query statement to be queried, to obtain a determination result, where the leaf query statement to be queried is a leaf query statement other than the target leaf query statement in the plurality of leaf query statements, and determining a target query result corresponding to the data query request according to a leave determination rule and a determination result corresponding to the leaf query statement to be queried, where the leave determination rule corresponding to the leaf query statement to be queried is determined according to a set operation type corresponding to an upper-level query of the leaf query statement to be queried. According to a second aspect of embodiments of the present disclosure, a data query system is provided, which includes a client and a server, wherein the client is configured to send a data query request to the server, the data query request includes at least one joint query statement, and the server is configured to process the data query request according to the data query method provided by any embodiment of the present disclosure. According to a third aspect of embodiments of the present disclosure, there is provided a data query apparatus, including a receiving module configured to receive a data query request, where the data query request includes at least one joint query statement, an analyzing 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 meeting a preset filtering condition and a target query result set of the target leaf query statements from the plurality of leaf query statements, and a judging module configured to judge whether each target query result in the target query result set hits a leaf query statement to be queried to obtain a judging result, where the leaf query statement to be queried is a leaf query statement other than the target leaf query statement in the plurality of leaf query statements, and a determining module configured to determine a target query result corresponding to the data query request according to a leave-out judging rule and a judging result corresponding to the leaf query statement to be queried, where the leave-out judging rule corresponding to the leaf query statement to be queried is determined according to a set operation type corresponding to an upper-level query of the leaf query statement to be queried. According to a fourth aspect of embodiments of the present specification, there is provided a computing device comprising a memory for storing computer executable instructions and a processor for executing the computer executable instructions which when executed by the processor implement the steps of the data queryi