Data query method, query table construction method, computing device, and storage medium

By processing data tables in batches and switching algorithms under certain conditions to construct query tables, the problem of low efficiency in query table construction is solved, thus improving data query efficiency.

CN116775645BActive Publication Date: 2026-03-20ALIBABA CLOUD COMPUTING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-19
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing technologies lack accurate methods for constructing query tables, resulting in low efficiency and consequently impacting data retrieval efficiency.

Method used

By processing the data tables in batches, a first target query table is constructed, and the query attribute information is detected. If the switching conditions are met, the hashjoin algorithm is switched to construct a second target query table, thus avoiding the waste of the first target query table.

Benefits of technology

It improves the efficiency of query table generation, ensures the efficiency of data query execution, and avoids waste caused by switching query table construction methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116775645B_ABST
    Figure CN116775645B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a data query method, wherein the data query method comprises: obtaining a query statement, determining at least two data tables corresponding to the query statement; calling a first operator, performing batch processing on the data tables, and constructing a first target query table according to data of a target batch in the at least two data tables, wherein the target batch is any batch; detecting query attribute information of the first target query table; in the case where the query attribute information satisfies a switching condition, constructing a second target query table based on remaining data in the at least two data tables, wherein the remaining data refers to data other than data included in the first target query table; and obtaining a data query result based on the first target query table and the second target query table. By constructing the second target query table based on the remaining data in the at least two data tables, that is, by switching the way of generating the query table, the efficiency of generating the query table is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present specification relate to the technical field of computer technology, and particularly relate to a data query method, a query table construction method, a computing device, and a storage medium. BACKGROUND

[0002] At present, when querying data in a database, there may be a case of needing to utilize two or more data tables to implement data query. In order to implement data query, a join algorithm can be generally used to connect data in a data table, construct a query table, and obtain the query table. Further, data query is completed based on the query table.

[0003] However, the current method of selecting a query table construction method by using an optimizer is not accurate enough, which may result in low query table construction efficiency and further result in low data query efficiency.

[0004] Therefore, it is necessary to provide a faster or more reliable solution to determine the query table construction method. SUMMARY

[0005] Therefore, the embodiments of the present specification provide a data query method. One or more embodiments of the present specification also relate to a data query apparatus, a query table construction method, a query table construction apparatus, a computing device, a computer readable storage medium, and a computer program to solve the technical defects in the prior art.

[0006] According to a first aspect of the embodiments of the present specification, a data query method is provided, including:

[0007] obtaining a query statement, determining at least two data tables corresponding to the query statement;

[0008] calling a first operator, performing batch processing on the data tables, and constructing a first target query table based on data of a target batch in the at least two data tables, wherein the target batch is any batch;

[0009] detecting query attribute information of the first target query table;

[0010] in a case where the query attribute information meets a switching condition, constructing a second target query table based on remaining data in the at least two data tables, wherein the remaining data refers to data other than data included in the first target query table;

[0011] obtaining a data query result based on the first target query table and the second target query table.

[0012] According to a second aspect of the embodiments of the present specification, a data query apparatus is provided, including:

[0013] An obtaining module is configured to obtain a query statement and determine at least two data tables corresponding to the query statement;

[0014] A first constructing module is configured to invoke a first operator, perform batch processing on the data tables, and construct a first target query table according to data of a target batch in the at least two data tables, where the target batch is any batch;

[0015] A detecting module is configured to detect query attribute information of the first target query table;

[0016] A second constructing module is configured to, when the query attribute information satisfies a switching condition, construct a second target query table based on remaining data in the at least two data tables, where the remaining data refers to data other than data included in the first target query table;

[0017] An obtaining module is configured to obtain a query statement and determine at least two data tables corresponding to the query statement;

[0018] According to a third aspect of an embodiment of the present specification, a query table construction method is provided, including:

[0019] An obtaining module is configured to obtain a query statement and determine at least two data tables corresponding to the query statement;

[0020] A first constructing module is configured to invoke a first operator, perform batch processing on the data tables, and construct a first target query table according to data of a target batch in the at least two data tables, where the target batch is any batch;

[0021] A detecting module is configured to detect query attribute information of the first target query table;

[0022] A second constructing module is configured to, when the query attribute information satisfies a switching condition, construct a second target query table based on remaining data in the at least two data tables, where the remaining data refers to data other than data included in the first target query table.

[0023] According to a fourth aspect of an embodiment of the present specification, a query table construction apparatus is provided, including:

[0024] An obtaining module is configured to obtain a query statement and determine at least two data tables corresponding to the query statement;

[0025] A first constructing module is configured to invoke a first operator, perform batch processing on the data tables, and construct a first target query table according to data of a target batch in the at least two data tables, where the target batch is any batch;

[0026] A detecting module is configured to detect query attribute information of the first target query table;

[0027] a second constructing module configured to, in a case where the query attribute information satisfies a switching condition, construct a second target query table based on remaining data in the at least two data tables, wherein the remaining data refers to data other than data included in the first target query table.

[0028] According to a fifth aspect of an embodiment of the present specification, a computing device is provided, comprising:

[0029] a memory and a processor;

[0030] 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 above method.

[0031] According to a sixth aspect of an embodiment of the present specification, a computer-readable storage medium is provided, which stores computer-executable instructions, which, when executed by a processor, implement the steps of the above method.

[0032] According to a seventh aspect of an embodiment of the present specification, a computer program is provided, which, when executed in a computer, causes the computer to perform the steps of the above method.

[0033] One embodiment of the present specification realizes the following. A query statement is obtained, and at least two data tables corresponding to the query statement are determined. A first operator is invoked to perform batch processing on the data tables, and a first target query table is constructed based on data of a target batch in the at least two data tables, wherein the target batch is any batch. Query attribute information of the first target query table is detected. In a case where the query attribute information satisfies a switching condition, a second target query table is constructed based on remaining data in the at least two data tables, wherein the remaining data refers to data other than data included in the first target query table. A data query result based on the first target query table and the second target query table is obtained.

[0034] By constructing a first target query table based on a query statement, a first target query table for data query is constructed based on data tables corresponding to the query statement. Query attribute information corresponding to the first target query table is detected, and in a case where the query attribute information satisfies a switching condition, a second target query table is constructed based on remaining data in the at least two data tables, i.e., the way of generating a query table is switched, thereby improving the efficiency of generating a query table. A data query result corresponding to the query statement is obtained based on the first target query table and the second target query table, which avoids the waste of the generated first target query table due to the switching of the query table construction method, thereby ensuring the execution efficiency of data query. BRIEF DESCRIPTION OF DRAWINGS

[0035] Figure 1 is a scenario diagram of a data query method provided by one embodiment of the present specification;

[0036] Figure 2 is a flowchart of a data query method provided by one embodiment of the present specification;

[0037] Figure 3 is a flowchart of a query table construction method provided by one embodiment of the present specification;

[0038] Figure 4 is a process flowchart of a data query method provided by one embodiment of the present specification;

[0039] Figure 5 is a structural diagram of a data query apparatus provided by one embodiment of the present specification;

[0040] Figure 6 is a structural diagram of a query table construction apparatus provided by one embodiment of the present specification;

[0041] Figure 7 is a structural block diagram of a computing device provided by one embodiment of the present specification. DETAILED DESCRIPTION

[0042] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present specification. However, the present specification can be practiced without the specific details, other than in the examples, set forth in this description. Those skilled in the art, in light of the description, can implement the present specification without limiting the scope of the present specification.

[0043] The terminology used in one or more embodiments of the present specification is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present specification. As used in one or more embodiments of the present specification and the accompanying claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in one or more embodiments of the present specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

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

[0045] In addition, it should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present specification are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.

[0046] First, the terms involved in one or more embodiments of the present specification are explained.

[0047] lookupjoin algorithm: a join algorithm that pulls data from one end of the probe hash table in batches, and for each batch of data, constructs a query condition to another table according to the batch of data, and then pulls the corresponding data according to the condition, constructs a hash table after pulling to the upper layer, and uses the batch of data from one end of the probe hash table to probe the hash table and output the result.

[0048] hashjoin algorithm: a join algorithm that uses one end of the constructed hash table to construct a hash table, and the other end of the probe hash table to probe the hash table and output the result.

[0049] CAS: compare and swap, which can be used to implement optimistic locking. There is no context switching of threads in CAS, which can reduce unnecessary overhead.

[0050] Optimizer: refers to a module for estimating the corresponding query table construction method for a computing node.

[0051] Currently, the join algorithm is usually selected by the optimizer, but the optimizer is based on statistical information and cost model to determine which execution method is better, and there will be errors. From the principle of the optimizer, the accuracy of the join algorithm cannot be guaranteed. Therefore, the data query method provided in the present specification further optimizes the selection of the join algorithm.

[0052] In the specification, a data query method is provided, and the specification also relates to a data query device, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0053] Referring to Figure 1 , Figure 1 A scenario schematic diagram of a data query method provided according to one embodiment of the specification is shown, which specifically includes the following steps.

[0054] The computing node receives a query statement; a lookupjoin algorithm allocated to the computing node by an optimizer; a lookupjoin operator is created on the computing node based on the lookupjoin algorithm; at least two data tables corresponding to the query statement are obtained; the lookup join operator is called to perform batch processing on a target data table in the at least two data tables, and data corresponding to each batch in the data table is obtained; based on the data corresponding to each batch, connection between the data tables is performed in batches, that is, a private hash table 1 is created based on data corresponding to a first batch, a private hash table 2 is created based on data corresponding to a second batch, a private hash table 3 is created based on data corresponding to a third batch, and connection processing between data of each batch and other data tables is completed based on the hash tables to obtain a first target query table corresponding to each batch, which is used for data query; in the case that the content of the data table is relatively large, the process of generating a query table based on the lookupjoin algorithm may be relatively low in execution efficiency, and the method of the specification detects query attribute information corresponding to the query table in the process of generating the query table in batches, and switches the current lookupjoin to a hashjoin algorithm in the case that the query attribute information meets switching conditions, thereby improving the algorithm execution efficiency, and further improving the hash table generation efficiency, so as to improve the generation efficiency of the query table based on the hash table; specifically, when the lookupjoin operator is created, a shared hash table is created, and the shared hash table does not contain data; in the case that query attribute information generated by executing the lookupjoin algorithm meets the switching conditions, a second target query table is constructed based on residual data in a data table that is not processed by the lookupjoin algorithm, that is, the shared hash table is filled based on the residual data, and the second target query table is constructed based on the filled shared hash table; in actual application, after the lookupjoin algorithm is switched to the hashjoin algorithm, an in expression is no longer constructed based on data in the data table, but is replaced by a tautology expression; and data query results are queried in the first target query table and the second query table based on the query statement.

[0055] The data query method of the specification obtains a query statement, determines at least two data tables corresponding to the query statement, calls a first operator, performs batch processing on the data tables, constructs a first target query table according to data of a target batch in the at least two data tables, wherein the target batch is any batch, detects query attribute information of the first target query table, and in the case that the query attribute information meets a switching condition, constructs a second target query table based on remaining data in the at least two data tables, wherein the remaining data refers to data other than data included in the first target query table, and obtains a data query result based on the first target query table and the second target query table.

[0056] By constructing a first target query table based on a query statement, a first target query table for data query is constructed based on data tables corresponding to the query statement. Query attribute information corresponding to the first target query table is detected, and in the case that the query attribute information meets a switching condition, a second target query table is constructed based on remaining data in the at least two data tables, that is, the way of generating the query table is switched, thereby improving the efficiency of generating the query table. The data query result corresponding to the query statement is obtained based on the first target query table and the second target query table, avoiding the waste of the generated first target query table due to the switching of the query table construction method, thereby ensuring the execution efficiency of data query.

[0057] Referring to Figure 2 , Figure 2 A flowchart of a data query method according to one embodiment of the specification is shown, specifically comprising the following steps.

[0058] Step 202: Obtain a query statement, and determine at least two data tables corresponding to the query statement.

[0059] The query statement refers to a statement used to query required data in a database, for example, a query statement SELECT name FROM student table used to query data in a database, which indicates querying name information in the name column in the student table. The data table refers to a table storing data in a database, for example, a student information table, a member information table, an order table, etc.

[0060] Specifically, in response to a data query request, a query statement is obtained. The query statement can be input by a user or generated based on a user data question text, etc. The method of obtaining the query statement is not limited in the specification. The obtained query statement is parsed, and at least two data tables corresponding to the query statement are determined. In actual application, the query statement can correspond to only one data table, but in the case of one data table, a data table connection operation is not needed, so the method of the specification is only used in the case that the query statement corresponds to two or more data tables.

[0061] In an embodiment of the present disclosure, in response to an order query request, a query statement for querying order data is determined; and data table 1 and data table 2 required in the order query process are determined based on the query statement.

[0062] In actual application, the method for determining the at least two data tables corresponding to the query statement can include:

[0063] Determining a query field contained in the query statement;

[0064] Finding a data table containing the query field in the database as the data table corresponding to the query statement.

[0065] Specifically, the query field refers to a field parsed in the query statement, for example, a field such as “member level” or “order number” is parsed in the query statement; and based on the query field, at least two data tables required for subsequent completion of data query are determined in the database.

[0066] At least two data tables corresponding to the query statement are determined through the obtained query statement, so as to perform data query based on the at least two data tables subsequently.

[0067] Step 204: calling a first operator to perform batch processing on the data table, and constructing a first target query table based on data of a target batch in the at least two data tables.

[0068] The first operator refers to a calculation unit for generating a query table based on data in a data table, and a plurality of operators can be included in one calculation node, and parallel processing of data can be realized based on the plurality of operators; the batch processing refers to dividing data in the data table into at least two parts; and the first target query table refers to a data table obtained by connecting data of a target batch in the data table; and the target batch refers to any batch corresponding to the data table.

[0069] Specifically, the first operator responds to a query table construction request to perform batch processing on one or more data tables selected from the at least two data tables corresponding to the query statement; data of a target batch in the at least two data tables is obtained, and a first target query table is constructed based on the data of the target batch.

[0070] In actual application, the method for performing batch processing on the data table can include:

[0071] Determining a target data table in the at least two data tables;

[0072] Performing batch processing on data in the target data table according to a processing quantity threshold value, and obtaining a data set corresponding to each batch.

[0073] The target data table refers to any one of the at least two data tables corresponding to the query statement; the processing quantity threshold refers to a pre-set upper limit value of data processing; in actual application, the processing quantity threshold can be set based on the upper limit value of the operator, for example, if the upper limit value of the operator is 20 pieces of data, the processing quantity threshold can be set to 20, thereby ensuring that the data corresponding to each target batch can be efficiently processed subsequently; the data set refers to a data collection composed of the data of the target batch in the data table, for example, if batch 1 corresponds to data 1, data 2 and data 3 in the data table, a data collection corresponding to batch 1 can be composed of data 1, data 2 and data 3.

[0074] Specifically, a target data table is selected from the at least two data tables corresponding to the query statement; the data in the target data table is processed in batches according to the processing quantity threshold, and each batch of data in the data table forms a data set corresponding to each batch.

[0075] In one embodiment of the present specification, data table 1 is selected as the target data table from data table 1, data table 2 and data table 3, and the target data table contains a total of 10 pieces of data from 1 to 10; it is determined that the processing quantity threshold is 5, and the data in the target data table is divided into two batches based on the processing quantity threshold, that is, the data from 1 to 5 in the target data table can be divided into a first batch, and the data from 6 to 10 in the target data table can be divided into a second batch.

[0076] The data in the data table is processed in batches by the processing quantity threshold, and the data set corresponding to each batch in the data table is determined, so that the data set corresponding to each batch is processed in batches subsequently, thereby reducing the processing pressure of the computing unit and ensuring the real-time performance of data processing.

[0077] In actual application, the method for constructing the first target query table according to the data of the target batch in the at least two data tables can include:

[0078] The data set corresponding to the target batch is determined, and the data in the data set is de-duplicated;

[0079] The first to-be-connected data is queried in the data table other than the target data table according to the de-duplicated data, and a hash table is generated based on the first to-be-connected data;

[0080] The matching field is queried in the data set based on the hash table;

[0081] The second to-be-connected data is obtained in the data set according to the matching field;

[0082] The first target query table is constructed according to the first to-be-connected data and the second to-be-connected data.

[0083] The de-duplication processing refers to de-duplicating data in the data set; the first to-be-connected data refers to data collected in a data table other than the target data table corresponding to the query statement based on the de-duplicated data; the hash table refers to a data table composed of the first to-be-connected data and a hash value corresponding to the first to-be-connected data; the matching field refers to a field in the data set that is consistent with the hash table, for example, if the hash table contains a field "Zhang San" and a corresponding hash value "123", it is determined that the data set contains the field "Zhang San", and the field "Zhang San" can be used as the matching field; the second to-be-connected data refers to data related to the matching field obtained in the data set based on the matching field, for example, it is determined that the matching field is "Zhang San", and the data set contains data "18 years old", "level 2 member" and the like related to the field "Zhang San", and the data "18 years old", "level 2 member" related to the field "Zhang San" are the second to-be-connected data.

[0084] Specifically, the lookupjoin algorithm is used to implement batch connection of the data table, and the query table corresponding to each batch is obtained, that is, the data set corresponding to the target batch is determined; the data in the data set is de-duplicated to obtain de-duplicated data, so as to improve the processing efficiency of the subsequent processing; the first to-be-connected data is queried in the data table other than the target data table based on the de-duplicated data, that is, the data consistent with the de-duplicated data is obtained in the data table other than the target data table; the hash table is generated based on the first to-be-connected data obtained by querying; the matching field is queried in the target data set of the target batch based on the hash table; the second to-be-connected data is obtained in the data set according to the matching field; and the first target query table is generated by connecting the first to-be-connected data and the second to-be-connected data.

[0085] In an embodiment of the present specification, it is determined that the data set contains data "a, b, c", the data in the data set is de-duplicated to obtain de-duplicated data "a, b"; the first to-be-connected data "a" is queried in the data table other than the target data table according to the de-duplicated data "a, b"; the hash table is generated based on the first to-be-connected data "a", and the hash table contains the field "a" and the hash value "124" corresponding to the field "a"; the matching field "a" is queried in the data set according to the hash table, and the data related to the matching field is obtained in the data set as the second to-be-connected data based on the matching field; and the first target query table is obtained by connecting the first to-be-connected data and the second to-be-connected data based on the matching field.

[0086] By constructing the first target query table according to the data of the target batch in the at least two data tables, the construction efficiency of the first target query table is improved, and the real-time performance of the first target query table is ensured.

[0087] Step 206: detecting query attribute information of the first target query table.

[0088] The query attribute information refers to attribute information obtained in the process of constructing the first target query table.

[0089] Specifically, since the first operator performs batch processing on the data table, it is necessary to generate the corresponding first target query table based on the data set corresponding to each batch; in the process of generating the first target query table of the current batch, the query attribute information of the current batch is detected, so as to subsequently judge whether the query table construction mode needs to be switched based on the query attribute information.

[0090] In actual application, the query attribute information includes at least one of the total number of query tables, the query execution time length, and the target connection number, the target connection number refers to the number of connections between the query unit and the storage unit.

[0091] The total number of query tables refers to the total number of generated first target query tables, in actual application, the batch number of executing queries can be determined by counting the number of first target query tables based on the first target query tables generated by each batch; the query execution time length refers to the time length of generating the first target query table in any batch; the target connection number refers to the number of transmission connections between the query unit and the storage unit in any batch.

[0092] Specifically, one or more of the total number of query tables, the query execution time length, and the target connection number can be used as query attribute information, for example, only the total number of query tables is used as the query attribute information of the first target query table, or the total number of query tables and the query execution time length are used as the query attribute information, and so on.

[0093] In a specific manner of the present specification, in the process of constructing the first target query table according to the data of the target batch in at least two data tables, the total number of generated first target query tables is counted as the query attribute information of the first target query table.

[0094] By detecting the query attribute information of the first target query table, it is subsequently judged whether the construction mode of the query table needs to be adjusted based on the query attribute information.

[0095] Step 208: in the case that the query attribute information meets the switching condition, a second target query table is constructed based on the remaining data in the at least two data tables, wherein the remaining data refers to data other than the data contained in the first target query table.

[0096] The switching condition refers to the condition for switching the query table construction method. The switching condition is set based on the construction information of the target query table. Specifically, the switching condition can be one or more of the following: the total number of queries in the first target query table is greater than or equal to a preset number threshold; the query execution time of the first target query table is greater than or equal to a preset time threshold. In other words, the switching condition is the upper limit condition for using the current query table construction method to construct the target query table. If this condition is exceeded, the query table construction method needs to be switched, thereby improving the efficiency of query table construction. The remaining data refers to the data of the data table that has not been processed during the construction of the first target query table, that is, the data other than the data contained in the first target query table. The second query table is the query table constructed based on the remaining data.

[0097] Specifically, before constructing the first target query table based on the data of each batch, it is determined whether the query attribute information corresponding to the first target query table meets the switching conditions; if the query attribute information does not meet the switching conditions, the first target query table is constructed based on the data corresponding to that batch; if the query attribute information meets the switching conditions, the query table construction method needs to be switched, that is, based on the remaining data in the at least two data tables, the second target query table is constructed.

[0098] In practical applications, a method for constructing a second target query table based on the remaining data in the at least two data tables may include:

[0099] Set the state of the pre-built shared hash table;

[0100] Based on the state settings and the remaining data in the at least two data tables, a second target query table is constructed.

[0101] Specifically, this specification proposes a solution that switches from a lookupjoin lookup table construction algorithm to a hashjoin lookup table construction algorithm. Since the lookupjoin lookup table construction algorithm does not have the concept of a shared hash table, an empty shared hash table is pre-created to enable the switch. Before switching from lookupjoin to hashjoin, the state of the pre-built shared hash table is obtained. If the state of the shared hash table can be set, it is necessary to further determine whether the shared hash table is filled. If it is not filled, the state of the shared hash table is set using CAS (compare and swap). Subsequently, the shared hash table needs to be filled based on the generated data. If it is filled, the second target lookup table can be constructed based on the shared hash table. If the state of the shared hash table cannot be set, it is necessary to wait for the shared hash table to become settable before proceeding with subsequent processing.

[0102] In an embodiment of the present disclosure, a state of a pre-constructed shared hash table A is set to obtain a state setting result; and a second target query table is constructed based on the state setting result and residual data in at least two data tables.

[0103] By setting the shared hash table, and then constructing the second target query table based on the setting state, the processing efficiency of the second target query table is improved.

[0104] In actual application, the method of constructing the second target query table based on the state setting result and the residual data in the at least two data tables can include:

[0105] In a case where the state setting result of the shared hash table is successful, a target data table in the at least two data tables is determined, and target residual data of the target data table is determined;

[0106] The shared hash table is filled with data based on the target residual data to obtain the second target query table.

[0107] The target data table refers to any one of the at least two data tables, and the target residual data refers to data that is not used to generate the first target query table in the target data table.

[0108] Specifically, in a case where the state setting result of the shared hash table is successful, it is further determined whether the shared hash table has been filled; if not, a target data table is selected from the at least two data tables, for example, a data table with the smallest data amount is selected as the target data table from the at least two data tables; target residual data in the target data table is determined; the shared hash table is filled based on the target residual data, and then the second target query table is obtained based on the filled shared hash table; if the shared hash table has been filled, the second target query table is constructed based on the shared hash table directly.

[0109] In an embodiment of the present disclosure, the state of the shared hash table is set based on a state setting request for the shared hash table; in a case where the state setting result obtained by setting the state of the shared hash table is successful, it is determined whether the shared hash table has been filled; if the shared hash table has not been filled, a target data table in the at least two data tables is determined, and target residual data corresponding to the target data table is determined; the shared hash table is filled based on the target residual data to obtain the second target query table.

[0110] By filling the shared hash table based on the target residual data in a case where the state setting result is successful, the second target query table is obtained based on the filled shared hash table.

[0111] Further, based on the target residual data, the shared hash table is filled with data to obtain a second target query table.

[0112] The hash value corresponding to the target residual data is calculated, and the shared hash table is filled based on the target residual data and the hash value.

[0113] The second target query table is constructed based on the filled shared hash table.

[0114] Specifically, the target residual data in the target data table is determined, the hash value corresponding to each target residual data is calculated, for example, based on a hash function, each target residual data and the hash value corresponding to each target residual data are filled into the shared hash table, thereby completing the filling of the shared hash table, and the second target query table is constructed based on the filled shared hash table.

[0115] Further, the method of constructing the second target query table based on the filled shared hash table can include:

[0116] According to the filled shared hash table, the matching field is queried in the data table other than the target data table, and the first to-be-connected data is obtained in the data table other than the target data table based on the matching field.

[0117] The second to-be-connected data is obtained in the target data table based on the matching field.

[0118] The second target query table is constructed according to the first to-be-connected data and the second to-be-connected data.

[0119] Among them, the first to-be-connected data refers to the data obtained in the data table other than the target data table according to the matching field; the second to-be-connected data refers to the data obtained in the target data table according to the matching field.

[0120] Specifically, according to the filled shared hash table, the corresponding matching field is queried in the data table other than the target data table, and the second to-be-connected data is obtained based on the matching field; the second to-be-connected data is obtained in the target data table based on the matching field; the second target query table is constructed based on the first to-be-connected data and the second to-be-connected data.

[0121] In a specific embodiment of the present specification, the filled shared hash table is obtained, and the matching field is queried in the data table other than the target data table based on the shared hash table; the first to-be-connected data is obtained in the data table other than the target data table according to the matching field; the second to-be-connected data is obtained in the target data table according to the matching field, and the second target query table is obtained by splicing the first to-be-connected data and the second to-be-connected data.

[0122] The second target query table is constructed through the filled shared hash table, so that the switching of the query table construction mode is realized, and then the second target query table is constructed based on the switched query table construction mode, so as to subsequently query data based on the second target query table.

[0123] In actual application, in order to improve processing efficiency, multiple operators can be set on one node, and the generation processing of the query table is performed by multiple operators; in the case of switching from lookupjoin to hashjoin, if one lookup join operator on the node completes the filling of the shared hash table at the time of switching, the remaining lookup join operators on the node do not need to fill the shared hash table again at the time of switching, and can directly use the filled shared data table.

[0124] Specifically, the method of the present specification further includes:

[0125] The second operator is called to perform batch processing on the data table, and a third target query table is constructed based on the data of the target batch in the at least two data tables;

[0126] In the case that the state setting result of the shared hash table is failure, and the query attribute information of the third target query table meets the switching condition, a fourth target query table is constructed based on the shared hash table.

[0127] Among them, the second operator refers to a calculation unit for generating a query table from data in a data table, which is different from the first operator; the third target query table refers to a query table constructed by the second operator based on data in at least two data tables; and the fourth target query table refers to a query table constructed based on the filled shared hash table.

[0128] Specifically, the data table is batch-processed by the second operator, and a third target query table is constructed based on the data of the target batch in the at least two data tables; the shared hash table is set based on the switching request, and if the state setting fails, it is further determined whether the shared hash table is filled; if yes, the fourth target query table is constructed based on the shared hash table after the shared hash table is set, and in the case that the query attribute information of the third target query table meets the switching condition, so as to complete the switching of the query table construction mode.

[0129] In an embodiment of the present disclosure, the second operator is called to perform batch processing on the data table; a third target query table is constructed based on data of a target batch in the at least two data tables; query attribute information of the third target query table is detected, and it is determined that the query attribute information of the current third target query table meets a switching condition, and then a state of the shared hash table is set; if the state setting result of the current shared hash table is a setting failure, the shared hash table is set to a blocking state; and when the shared hash table can be set, a fourth target query table is constructed based on the shared hash table.

[0130] The second operator is switched to determine whether the operator can be switched; when it is determined that the operator can be switched, it is further determined whether the shared hash table is filled, and when the shared hash table is filled, a query table is constructed based on the filled shared hash table, and the construction efficiency of the query table is improved.

[0131] Step 210: obtaining a data query result based on the first target query table and the second target query table.

[0132] The data query result refers to a query result corresponding to the query statement.

[0133] In actual application, in order to ensure the data query efficiency and the real-time performance of the data query efficiency, after the first target query table is constructed, the following steps are further included:

[0134] A first query result corresponding to the query statement is queried in the first target query table.

[0135] The first query result refers to a result queried in the first query table based on the query statement; specifically, after the first target query table is generated, data can be queried in the first query table based on the query statement, and the current first query result can be returned to the user, so that the time for the user to wait for the query result is reduced.

[0136] The first query result is not a complete query result, and a remaining query table needs to be constructed in the future, and the result is queried based on the remaining query table.

[0137] Specifically, the method for obtaining the data query result based on the first target query table and the second target query table can include the following steps:

[0138] A second query result corresponding to the query statement is queried in the second target query table.

[0139] Based on the first query result of the first query table and the second query result of the second query table, a data query result corresponding to the query statement is determined.

[0140] Specifically, the second query result refers to a result queried in the second query table; after obtaining the first query result and the second query result, the first query result and the second query result are merged to obtain a total query result corresponding to the query statement, that is, the first query result.

[0141] In a specific embodiment of the present application, after generating the first target query table, the first query result is queried in the first target query table based on the query statement; after generating the second target query table, the first query result is queried in the second target query table based on the query statement; the first query result and the second query result are merged to obtain a data query result corresponding to the query statement.

[0142] By generating a query table, the data query is completed to obtain a partial data query result; then, based on the partial query results, the data query result is obtained, thereby realizing efficient data query.

[0143] The data query method of the present application obtains a query statement, determines at least two data tables corresponding to the query statement, calls a first operator, performs batch processing on the data tables, constructs a first target query table based on data of a target batch in the at least two data tables, wherein the target batch is any batch, detects query attribute information of the first target query table, constructs a second target query table based on remaining data in the at least two data tables in the case that the query attribute information meets a switching condition, wherein the remaining data refers to data other than data included in the first target query table, and obtains a data query result based on the first target query table and the second target query table.

[0144] By constructing a first target query table based on a query statement, a first target query table for data query is constructed based on a data table corresponding to the query statement; the query attribute information corresponding to the first target query table is detected, and in the case that the query attribute information meets a switching condition, a second target query table is constructed based on remaining data in the at least two data tables, that is, the way of generating a query table is switched, thereby improving the efficiency of generating a query table; the data query result corresponding to the query statement is obtained based on the first target query table and the second target query table, which avoids the waste of the generated first target query table due to the switching of the query table construction method, thereby ensuring the execution efficiency of data query

[0145] Referring to Figure 3 , Figure 3 A flowchart of a query table construction method according to one embodiment of the present application is shown, which specifically includes the following steps.

[0146] Step 302: Obtain a query statement and determine at least two data tables corresponding to the query statement.

[0147] Step 304: calling a first operator, performing batch processing on the data table, and constructing a first target query table according to data of a target batch in the at least two data tables, wherein the target batch is any batch.

[0148] Step 306: detecting query attribute information of the first target query table.

[0149] Step 308: in a case where the query attribute information satisfies a switching condition, constructing a second target query table based on remaining data in the at least two data tables, wherein the remaining data refers to data other than data included in the first target query table.

[0150] The query table construction method of the present specification acquires a query statement, determines at least two data tables corresponding to the query statement, calls a first operator, performs batch processing on the data table, and constructs a first target query table according to data of a target batch in the at least two data tables, wherein the target batch is any batch, detects query attribute information of the first target query table, and in a case where the query attribute information satisfies a switching condition, constructs a second target query table based on remaining data in the at least two data tables, wherein the remaining data refers to data other than data included in the first target query table.

[0151] By constructing a first target query table based on a query statement, a first target query table for data query is constructed based on data tables corresponding to the query statement. Query attribute information corresponding to the first target query table is detected, and in a case where the query attribute information satisfies a switching condition, a second target query table is constructed based on remaining data in the at least two data tables, that is, the way of generating the query table is switched, thereby improving the efficiency of generating the query table.

[0152] The following is a combination of the accompanying Figure 4 The data query method provided in the present specification is further described by taking an application of the data query method in student data query as an example. Wherein, Figure 4 A processing process flow diagram of a data query method provided by one embodiment of the present specification is shown, which specifically includes the following steps.

[0153] Step 402: acquiring a query statement and determining at least two student information tables corresponding to the query statement.

[0154] Step 404: calling a first operator, performing batch processing on a target student information table, and constructing a first target query table based on data of a target batch.

[0155] Specifically, a data set corresponding to the target batch is determined, and the data in the data set is de-duplicated; first to-be-connected data is queried in the student information table except the target student information table according to the de-duplicated data, and a hash table is generated based on the first to-be-connected data; the matching field is queried in the data set based on the hash table; second to-be-connected data is obtained in the data set according to the matching field; and a first target query table is constructed according to the first to-be-connected data and the second to-be-connected data.

[0156] Step 406: detecting query attribute information of the first target query table.

[0157] Step 408: in a case where the query attribute information meets a switching condition, constructing a second target query table based on remaining data in the at least two student information tables, wherein the remaining data refers to data other than the data contained in the at least two student information tables.

[0158] Specifically, the state of the pre-constructed shared hash table is set; in a case where the state setting result of the shared hash table is successful, a target student information table in the at least two student information tables and target remaining data of the target student information table are determined; a hash value corresponding to the target remaining data is calculated, and the shared hash table is filled based on the target remaining data and the hash value; first to-be-connected data is obtained in the student information table except the target student information table according to the matching field based on the filled shared hash table; second to-be-connected data is obtained in the target student information table based on the matching field; and a second target query table is constructed according to the first to-be-connected data and the second to-be-connected data.

[0159] Step 410: generating a data query result based on the first target query table and the second target query table.

[0160] The data query method in the embodiments of the present specification constructs a first target query table based on a query statement, thereby realizing the construction of the first target query table for data query based on the student information table corresponding to the query statement; detects query attribute information corresponding to the first target query table, and in a case where the query attribute information meets a switching condition, constructs a second target query table based on remaining data in the at least two student information tables, that is, the way of generating the query table is switched, thereby improving the efficiency of generating the query table; and obtains a data query result corresponding to the query statement based on the first target query table and the second target query table, thereby avoiding the waste of the generated first target query table due to the switching of the query table construction method, and thereby ensuring the execution efficiency of the student information data query.

[0161] Corresponding to the above method embodiments, the present specification also provides data query device embodiments, Figure 5A structural schematic diagram of a data query device provided by one embodiment of the present specification is shown. As shown in Figure 5 The device comprises:

[0162] An acquisition module 502 is configured to acquire a query statement, and determine at least two data tables corresponding to the query statement.

[0163] A first construction module 504 is configured to call a first operator, perform batch processing on the data tables, and construct a first target query table according to data of a target batch in the at least two data tables, wherein the target batch is any batch.

[0164] A detection module 506 is configured to detect query attribute information of the first target query table.

[0165] A second construction module 508 is configured to, in a case where the query attribute information satisfies a switching condition, construct a second target query table based on remaining data in the at least two data tables, wherein the remaining data refers to data other than data included in the first target query table.

[0166] An obtaining module 510 is configured to obtain a data query result based on the first target query table and the second target query table.

[0167] Optionally, the second construction module 508 is further configured to:

[0168] perform state setting on a pre-constructed shared hash table;

[0169] construct the second target query table based on a result of the state setting and the remaining data in the at least two data tables.

[0170] Optionally, the second construction module 508 is further configured to:

[0171] in a case where a state setting result of the shared hash table is successful, determine a target data table in the at least two data tables and target remaining data of the target data table;

[0172] perform data filling on the shared hash table based on the target remaining data, and obtain the second target query table.

[0173] Optionally, the second construction module 508 is further configured to:

[0174] calculate a hash value corresponding to the target remaining data, and fill the shared hash table based on the target remaining data and the hash value;

[0175] construct the second target query table based on the filled shared hash table.

[0176] Optionally, the second construction module 508 is further configured to:

[0177] According to the filled shared hash table, a matching field is queried in the data table other than the target data table, and first to-be-connected data is obtained in the data table other than the target data table based on the matching field;

[0178] Second to-be-connected data is obtained in the target data table based on the matching field;

[0179] According to the first to-be-connected data and the second to-be-connected data, a second target query table is constructed.

[0180] Optionally, the apparatus further comprises a construction submodule configured to:

[0181] A second operator is invoked to perform batch processing on the data table, and a third target query table is constructed according to data of a target batch in the at least two data tables;

[0182] In a case where a state setting result of the shared hash table is failure, and query attribute information of the third target query table meets a switching condition, a fourth target query table is constructed based on the shared hash table.

[0183] Optionally, the query attribute information comprises at least one of a total number of query tables, a query execution time length, and a target connection number, wherein the target connection number refers to a number of connections between a query unit and a storage unit.

[0184] Optionally, the obtaining module 510 is further configured to:

[0185] A first query result corresponding to the query statement is queried in the first target query table;

[0186] Correspondingly, obtaining a data query result based on the first target query table and the second target query table comprises:

[0187] A second query result corresponding to the query statement is queried in the second target query table;

[0188] Based on the first query result of the first query table and the second query result of the second query table, a data query result corresponding to the query statement is determined.

[0189] Optionally, the first construction module 504 is further configured to:

[0190] A data set corresponding to the target batch is determined, and data in the data set is de-duplicated;

[0191] According to the deduplicated data, first to-be-connected data is queried in a data table other than the target data table, and a hash table is generated based on the first to-be-connected data;

[0192] Based on the hash table, a matching field is queried in the data set;

[0193] According to the matching field, second to-be-connected data is obtained in the data set;

[0194] According to the first to-be-connected data and the second to-be-connected data, a first target query table is constructed.

[0195] Optionally, the obtaining module 502 is further configured to:

[0196] Determine the query field contained in the query statement;

[0197] Find a data table containing the query field in the database as the data table corresponding to the query statement.

[0198] Optionally, the switching condition includes at least one of the following: the total number of query tables of the first target query table is greater than or equal to a preset number threshold, and the query execution time length of the first target query table is greater than or equal to a preset time length threshold.

[0199] The data query device of the present specification obtains a query statement, determines at least two data tables corresponding to the query statement, calls a first operator to perform batch processing on the data tables, and constructs a first target query table based on the data of a target batch in the at least two data tables, wherein the target batch is any batch. Detect the query attribute information of the first target query table; in the case that the query attribute information meets the switching condition, construct a second target query table based on the remaining data in the at least two data tables, wherein the remaining data refers to data other than the data contained in the first target query table; obtain the data query result based on the first target query table and the second target query table.

[0200] By constructing a first target query table based on a query statement, a first target query table for data query is constructed based on the data table corresponding to the query statement. The query attribute information corresponding to the first target query table is detected, and in the case that the query attribute information meets the switching condition, a second target query table is constructed based on the remaining data in the at least two data tables, that is, the way of generating the query table is switched, thereby improving the efficiency of generating the query table. Based on the first target query table and the second target query table, the data query result corresponding to the query statement is obtained, which avoids the waste of the generated first target query table due to the switching of the query table construction method, thereby ensuring the execution efficiency of data query

[0201] Corresponding to the method embodiments described above, the present specification also provides query table construction device embodiments, Figure 6 A structural schematic diagram of a query table construction device provided by one embodiment of the present specification is shown. As shown in the figure, Figure 6 The device comprises:

[0202] The acquisition module 602 is configured to acquire a query statement and determine at least two data tables corresponding to the query statement.

[0203] The first construction module 604 is configured to call a first operator, perform batch processing on the data tables, and construct a first target query table according to data of a target batch in the at least two data tables, wherein the target batch is any batch.

[0204] The detection module 606 is configured to detect query attribute information of the first target query table.

[0205] The second construction module 608 is configured to, in a case where the query attribute information satisfies a switching condition, construct a second target query table based on remaining data in the at least two data tables, wherein the remaining data refers to data other than data included in the first target query table.

[0206] The query table construction device of the present specification acquires a query statement, determines at least two data tables corresponding to the query statement, calls a first operator, performs batch processing on the data tables, constructs a first target query table according to data of a target batch in the at least two data tables, wherein the target batch is any batch, detects query attribute information of the first target query table, and in a case where the query attribute information satisfies a switching condition, constructs a second target query table based on remaining data in the at least two data tables, wherein the remaining data refers to data other than data included in the first target query table.

[0207] By constructing a first target query table based on a query statement, a first target query table for data query is constructed based on data tables corresponding to the query statement. Query attribute information corresponding to the first target query table is detected, and in a case where the query attribute information satisfies a switching condition, a second target query table is constructed based on remaining data in the at least two data tables, that is, the way of generating a query table is switched, thereby improving the efficiency of generating a query table.

[0208] The above is a schematic scheme of the data query device of the present embodiment. It should be noted that the technical scheme of the data query device belongs to the same concept as the technical scheme of the data query method described above, and the details of the technical scheme of the data query device that are not described in detail can be referred to the description of the technical scheme of the data query method.

[0209] Figure 7 A structural block diagram of a computing device 700 is shown, according to one embodiment of the present specification. The components of the computing device 700 include, but are not limited to, a memory 710 and a processor 720. The processor 720 is connected to the memory 710 through a bus 730, and a database 750 is used to store data.

[0210] The computing device 700 also includes an access device 740 that enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 740 can include one or more of any type of network interface (e.g., a network interface card (NIC)), wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, Near Field Communication (NFC).

[0211] In one embodiment of the present specification, the above-mentioned components of the computing device 700 and other components not shown in the Figure 7 may be connected to each other, for example, through a bus. It should be understood that Figure 7 the structural block diagram of the computing device shown is only for the purpose of example, and is not a limitation on the scope of the present specification. Other components can be added or replaced as needed by those skilled in the art.

[0212] The computing device 700 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 700 can also be a mobile or stationary server.

[0213] The processor 720 is configured to execute computer-executable instructions to perform the steps of the data query method described above.

[0214] The above is a schematic solution of the computing device according to the embodiment. It should be noted that the technical solution of the computing device and the technical solution of the data query method described above belong to the same concept, and the details of the technical solution of the computing device that are not described in detail can be referred to the description of the technical solution of the data query method.

[0215] An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the data query method described above.

[0216] The above is a schematic solution of the computer-readable storage medium according to the embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the data query method described above belong to the same concept, and the details of the technical solution of the storage medium that are not described in detail can be referred to the description of the technical solution of the data query method.

[0217] An embodiment of the present specification further provides a computer program, which, when executed in a computer, causes the computer to perform the steps of the data query method described above.

[0218] The above is a schematic solution of the computer program according to the embodiment. It should be noted that the technical solution of the computer program and the technical solution of the data query method described above belong to the same concept, and the details of the technical solution of the computer program that are not described in detail can be referred to the description of the technical solution of the data query method.

[0219] The above-described embodiments of the application have several aspects, no single one of which is solely responsible for the application's desirable attributes. Without limiting the scope of the application as expressed by the claims which follow, some further embodiments make these aspects even more useful. Other embodiments can result in less desirable attributes.

[0220] The computer readable medium can include any entity or apparatus capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable medium can include appropriate contents according to the requirements of patent practice, for example, according to the patent practice in some regions, the computer readable medium does not include electrical carrier signals and telecommunication signals.

[0221] It should be noted that for the foregoing method embodiments, the acts described can be performed in a different order than that described, and that various embodiments can be combined in different ways. Further, it should be noted that the embodiments described are preferred embodiments, and that not all of the acts described are necessary to achieve the desired results. It should also be noted that the described embodiments are merely examples of the ways in which the application can be implemented.

[0222] In the above embodiments, the description of each embodiment is focused on different aspects, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0223] The preferred embodiments of the present specification disclosed above are only used to help explain the present specification. The alternative embodiments do not describe all the details and do not limit the application to the specific embodiments described. Obviously, according to the content of the embodiments of the present specification, many modifications and changes can be made. The present specification selects and describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present specification, so that those skilled in the art can well understand and use the present specification. The present specification is limited by the claims and their full scope and equivalents.

Claims

1. A data query method, comprising: Obtain the query statement and determine at least two data tables corresponding to the query statement; The first operator is invoked to process the data table in batches. Based on the data of the target batch in the at least two data tables, a first target query table is constructed, wherein the first target query table is obtained by joining the data of the target batch in the at least two data tables. Detect the query attribute information of the first target query table; When the query attribute information meets the switching conditions, a second target query table is constructed based on the remaining data in the at least two data tables. The remaining data refers to data other than the data contained in the first target query table, and refers to the data of the data table that was not processed during the construction of the first target query table. The second target query table is obtained by connecting the remaining data in the at least two data tables. Obtain data query results based on the first target query table and the second target query table.

2. The method as described in claim 1, wherein a second target query table is constructed based on the remaining data in the at least two data tables, comprising: Set the state of the pre-built shared hash table; Based on the state settings and the remaining data in the at least two data tables, a second target query table is constructed.

3. The method as described in claim 2, wherein a second target query table is constructed based on the result of the state setting and the remaining data in the at least two data tables, comprising: If the state setting result of the shared hash table is successful, determine the target data table in the at least two data tables, and the target remaining data in the target data table; Based on the remaining target data, the shared hash table is populated with data to obtain the second target query table.

4. The method as described in claim 3, wherein based on the target remaining data, data is populated into the shared hash table to obtain a second target query table, comprising: Calculate the hash value corresponding to the target remaining data, and populate the shared hash table based on the target remaining data and the hash value; Construct a second target query table based on the populated shared hash table.

5. The method of claim 4, wherein constructing a second target query table based on the populated shared hash table includes: Based on the filled shared hash table, query the matching field in the data tables other than the target data table, and obtain the first data to be connected in the data tables other than the target data table based on the matching field; Based on the matching field, obtain the second data to be connected from the target data table; Based on the first data to be connected and the second data to be connected, construct a second target query table.

6. The method of claim 2, further comprising: The second operator is invoked to process the data table in batches, and a third target query table is constructed based on the data of the target batch in the at least two data tables. If the state setting result of the shared hash table fails and the query attribute information of the third target query table meets the switching conditions, a fourth target query table is constructed based on the shared hash table.

7. The method as described in claim 1, wherein the query attribute information includes at least one of the following: total number of query tables, query execution time, and number of target joins. The target number of connections refers to the number of connections between the query unit and the storage unit.

8. The method of claim 1, after constructing the first target query table, further includes: Query the first query result corresponding to the query statement in the first target query table; Accordingly, obtaining data query results based on the first target query table and the second target query table includes: Query the second query result corresponding to the query statement in the second target query table; Based on the first query result of the first target query table and the second query result of the second target query table, the data query result corresponding to the query statement is determined.

9. The method of claim 1, wherein constructing a first target query table based on the data of the target batch in the at least two data tables, includes: Determine the dataset corresponding to the target batch, and perform deduplication on the data in the dataset; Based on the deduplicated data, query the first data to be joined in the data tables other than the target data table, and generate a hash table based on the first data to be joined; Based on the hash table, query the matching field in the dataset; The second data to be connected is obtained from the dataset based on the matching field. Based on the first data to be connected and the second data to be connected, construct a first target query table.

10. The method of claim 1, wherein determining at least two data tables corresponding to the query statement includes: Determine the query fields included in the query statement; The database is searched for a data table containing the query field, which is then used as the data table corresponding to the query statement.

11. The method as described in claim 1, wherein the switching conditions include at least one of the following: the total number of query tables in the first target query table is greater than or equal to a preset number threshold, and the query execution time of the first target query table is greater than or equal to a preset time threshold.

12. A method for constructing a query table, comprising: Obtain the query statement and determine at least two data tables corresponding to the query statement; The first operator is invoked to process the data table in batches. Based on the data of the target batch in the at least two data tables, a first target query table is constructed, wherein the target batch is any batch, and the first target query table is obtained by joining the data of the target batch in the at least two data tables. Detect the query attribute information of the first target query table; If the query attribute information meets the switching conditions, a second target query table is constructed based on the remaining data in the at least two data tables. The remaining data refers to data other than the data contained in the first target query table, and refers to the data in the data table that was not processed during the construction of the first target query table. The second target query table is obtained by connecting the remaining data in the at least two data tables.

13. 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 method according to any one of claims 1 to 12.

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

15. A computer program product comprising computer instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Systems and methods for implementing connection mirroring in a multi-core system

    CN103503424A

  • Data query method and device, electronic equipment and storage medium

    CN115374157A