Data query method and device, equipment and medium

By splitting the associated query statements and independently querying between database clusters, the problem of large amount of data export and import in cross-cluster data queries is solved, and more efficient query performance and storage resource utilization is achieved.

CN119691018APending Publication Date: 2025-03-25MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411472421.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

When conducting cross-cluster data queries between database clusters, how to effectively reduce the amount of data export and import, reduce storage resource overhead and network latency?

Method used

By splitting the association query statement, querying is conducted independently for each cluster to avoid importing data between different clusters. The specific steps include obtaining the association query statement, splitting out the query statement for the second cluster, querying the second cluster through the statement, obtaining the query data and writing it to the first cluster, and finally performing the association query in the first cluster to obtain the final result.

Benefits of technology

This method effectively reduces the amount of data transmitted across cluster data, reduces network latency and storage resource overhead, and improves query performance and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119691018A_ABST
    Figure CN119691018A_ABST
Patent Text Reader

Abstract

The invention provides a data query method and device, equipment and a medium, and relates to the technical field of data processing. The method comprises the steps that an associated query statement is obtained, the associated query statement is used for carrying out associated query in to-be-associated clusters, and the to-be-associated clusters comprise a first cluster and a second cluster; splitting a query statement for the second cluster from the associated query statement; querying the second cluster through the query statement of the second cluster to obtain query data of the second cluster; writing query data of the second cluster into the first cluster; and querying the first cluster through the associated query statement to obtain a query result of the associated query statement. According to the embodiment of the invention, the query statements aiming at the second clusters can be split from the associated query statements, and the query can be independently carried out in different clusters, so that data does not need to be mutually imported between different second clusters, the network delay caused by cross-cluster transmission of the data is effectively reduced, and the query performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a data query method, device, equipment and medium. Background Art

[0002] As the amount of data and business scale continue to grow, traditional single databases can no longer meet the requirements of high performance and high availability. To solve these problems, more and more companies are beginning to adopt database clustering technology solutions. Database clusters improve the overall performance and reliability of the system by distributing data across multiple physical nodes. However, when data is stored in different database clusters, how to effectively perform cross-cluster data queries becomes a new challenge.

[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0004] The present disclosure provides a data query method, apparatus, device and medium, which can perform cross-cluster query between different clusters, and the amount of data required to be exported and imported between different clusters during the query process is small, effectively reducing the database cluster storage resource overhead.

[0005] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0006] According to one aspect of the present disclosure, a data query method is provided, comprising:

[0007] Obtaining an associated query statement, where the associated query statement is used to perform an associated query in the clusters to be associated, where the clusters to be associated include the first cluster and the second cluster;

[0008] Separate the query statement for the second cluster from the associated query statement:

[0009] querying the second cluster through the query statement of the second cluster to obtain query data of the second cluster;

[0010] Writing query data of the second cluster into the first cluster;

[0011] The first cluster is queried through the associated query statement to obtain a query result of the associated query statement.

[0012] According to another aspect of the present disclosure, there is provided a data query device, comprising:

[0013] A statement acquisition module, used for acquiring an associated query statement, where the associated query statement is used for performing an associated query in the clusters to be associated, where the clusters to be associated include a first cluster and a second cluster;

[0014] The statement splitting module is used to split the query statement for the second cluster from the associated query statement:

[0015] A first query module, configured to query the second cluster using a query statement of the second cluster to obtain query data of the second cluster;

[0016] A data writing module, used for writing the query data of the second cluster into the first cluster;

[0017] The second query module is used to query the first cluster through the associated query statement to obtain the query result of the associated query statement.

[0018] According to another aspect of the present disclosure, an electronic device is provided, including: a memory for storing instructions; and a processor for calling the instructions stored in the memory to implement the above-mentioned data query method.

[0019] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which computer instructions are stored. When the computer instructions are executed by a processor, the above-mentioned data query method is implemented.

[0020] According to another aspect of the present disclosure, a computer program product is provided. The computer program product stores instructions, and when the instructions are executed by a computer, the computer implements the above data query method.

[0021] According to yet another aspect of the present disclosure, there is provided a chip, comprising at least one processor and an interface;

[0022] An interface for providing program instructions or data to at least one processor;

[0023] At least one processor is used to execute program instructions to implement the above data query method.

[0024] The data query method, apparatus, device and medium provided by the embodiments of the present disclosure split the query statement for the second cluster in the associated query statement, and then perform separate queries in different clusters through the split query statement, thereby eliminating the need to import data between different second clusters, effectively reducing network delays caused by cross-cluster data transmission and improving query performance; in addition, during the entire query process, only the query data of the second cluster needs to be written into the first cluster, and subsequent associated query operations can be completed within the first cluster. Compared with importing the full amount of data of the table to be queried in the second cluster into the first cluster, the amount of data imported during the query process is reduced, thereby improving query efficiency.

[0025] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0027] Obviously, the drawings described below are only some embodiments of the present disclosure, and a person skilled in the art can obtain other drawings based on these drawings without any creative work.

[0028] Figure 1 A schematic diagram showing the architecture of a data query system in an embodiment of the present disclosure is shown;

[0029] Figure 2 A flow chart of a data query method in an embodiment of the present disclosure is shown;

[0030] Figure 3 A schematic diagram showing the metadata structure of a user table in an embodiment of the present disclosure is shown;

[0031] Figure 4 A schematic diagram showing the metadata structure of a real estate table in an embodiment of the present disclosure is shown;

[0032] Figure 5 A schematic diagram showing the metadata structure of a bank table in an embodiment of the present disclosure is shown;

[0033] Figure 6 A schematic diagram showing the metadata structure of a repayment table in an embodiment of the present disclosure is shown;

[0034] Figure 7 A data writing flow chart according to an embodiment of the present disclosure is shown;

[0035] Figure 8 Another data query method flow chart in the embodiment of the present disclosure is shown;

[0036] Fig. 9 A flow chart of another data query method in an embodiment of the present disclosure is shown;

[0037] Fig.10 A schematic diagram of a data query platform in an embodiment of the present disclosure is shown;

[0038] Fig.11 A schematic diagram of a data query device in an embodiment of the present disclosure is shown;

[0039] Fig.12 A structural block diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.

[0041] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0042] For ease of understanding, the following first explains the relevant concepts involved in the present disclosure as follows:

[0043] Cross-cluster queries refer to query operations performed between more than one database cluster. When data is scattered across different clusters, cross-cluster queries need to be performed in order to obtain complete information.

[0044] A join query statement is a data query statement that involves obtaining data from multiple tables and connecting these tables through common fields (such as foreign keys) to form a complete data set.

[0045] In the context of database clusters, cross-cluster queries using join queries require obtaining data from multiple tables distributed in different clusters and combining the data through appropriate join conditions. In order to efficiently execute such queries, it is usually necessary to design specialized middleware or use a distributed query engine to process them to ensure query efficiency and data consistency.

[0046] The present exemplary implementation is described in detail below with reference to the accompanying drawings and embodiments.

[0047] Figure 1 A schematic diagram of a system architecture in which the data query method in the embodiment of the present disclosure can be applied is shown as follows: Figure 1 As shown, the system architecture includes electronic device 101 , cluster 102 , cluster 103 , and cluster 104 .

[0048] It should be noted that electronic device 101 may be a terminal device, an application server or a query server. Clusters 102, 103 and 104 may be database servers, which may query, insert, modify, delete and other operations on the database according to the received database operation request.

[0049] Cluster 102, cluster 103 and cluster 104 may include a first cluster and a second cluster, for example, cluster 102 is a first cluster, and clusters 103 and 104 are second clusters. In some embodiments, the first cluster may also be referred to as a primary cluster, and the second cluster may also be referred to as a non-primary cluster.

[0050] The data query method provided by the embodiment of the present disclosure may be executed by the electronic device 101, and the data query device may be disposed in the electronic device 101. In addition, a client may be installed in the electronic device 101, and the data query method provided by the embodiment of the present disclosure may be executed by the client.

[0051] Understandably, Figure 1 The number of electronic devices and clusters in the embodiment is only for illustration. Any number of electronic devices and clusters may be provided according to actual needs.

[0052] Figure 2 A flow chart of a data query method in an embodiment of the present disclosure is shown as follows: Figure 2 As shown, the data query method provided in the embodiment of the present disclosure includes steps S201-S205.

[0053] In S201, an associated query statement is obtained, where the associated query statement is used to perform an associated query in the clusters to be associated, where the clusters to be associated include a first cluster and a second cluster.

[0054] The first cluster may be a primary cluster, the second cluster may be a non-primary cluster, and there may be multiple second clusters.

[0055] The association query statement is used to query data in multiple tables to be queried, and the multiple tables to be queried are distributed in the cluster to be associated. In some embodiments, the cluster to be associated includes a first cluster and multiple second clusters, and the multiple tables to be queried can be distributed in multiple second clusters, that is, the tables to be queried do not exist in the first cluster. In some embodiments, the multiple tables to be queried can be distributed in the first cluster and the second cluster, that is, the tables to be queried exist in the first cluster.

[0056] In some embodiments, the association type of the association query statement can be an inner join (INNER JOIN), a left join (LEFT JOIN or LEFT OUTER JOIN), a right join (RIGHT JOIN or RIGHT OUTER JOIN), a full join (FULLOUTER JOIN) or a self join (SELF JOIN).

[0057] In S202, a query statement for the second cluster is separated from the associated query statement.

[0058] In some embodiments, the cluster to be associated includes a first cluster and multiple second clusters, and the multiple tables to be queried may be distributed in the multiple second clusters, and the above splitting out the query statements for the second clusters may be splitting out the query statements for each second cluster. Assuming that the tables to be queried are distributed in three second clusters, three query statements may be split out here, each query statement is for one second cluster, and one second cluster may contain one or more tables to be queried.

[0059] In S203, the second cluster is queried using the query statement of the second cluster to obtain query data of the second cluster.

[0060] In S204, the query data of the second cluster is written into the first cluster.

[0061] Here, only the query data is written into the first cluster. Compared with the solution of importing all the data of the table to be queried in the second cluster into the first cluster, the amount of data required to be imported is less.

[0062] In S205, the first cluster is queried through the associated query statement to obtain a query result of the associated query statement.

[0063] Since the query data of the second cluster has been written into the first cluster in S204, the first cluster contains all the data required for the associated query statement. Therefore, the query result corresponding to the associated query statement can be obtained by querying in the first cluster.

[0064] The disclosed embodiment splits out the query statement for the second cluster in the associated query statement, and then performs separate queries in different clusters through the split query statement, thereby eliminating the need to import data between different second clusters, effectively reducing network delays caused by cross-cluster data transmission and improving query performance.

[0065] The above solution is explained below through a specific example.

[0066] The C1 cluster is the storage database of the user system. The C1 cluster includes the user table (user table). The user table stores the user's user ID, name, age, phone number and other information. The metadata structure of the user table is as follows: Figure 3 shown.

[0067] The C2 cluster is the storage database of the real estate system. The C1 cluster includes the real estate table (House table). The House table stores information such as the real estate ID, user ID, city, street, address, loan bank card number, etc. The metadata structure of the House table is as follows: Figure 4 shown.

[0068] The C3 cluster is the storage database of the banking system. The C3 cluster includes the bank table (bank table) and the repayment table (repayment table). The bank table stores information such as bank name, user ID, bank card number, and card application time. The metadata structure of the bank table is as follows: Figure 5 The repayment table stores information such as bank card number, repayment time, and repayment amount. The metadata structure of the repayment table is as follows: Figure 6 shown.

[0069] Cluster C1 is the first cluster, i.e. the main cluster, and clusters C2 and C3 are the second clusters, i.e. non-main clusters. Assuming that you need to collect the mortgage repayment information of all users in the system to analyze the repayment risk of users, you can write the following associated query statement:

[0070]

[0071] In some embodiments, the above-mentioned association query statement can also be written in the following internal association manner:

[0072]

[0073] In S202, the above-mentioned associated query statements are split to obtain query statements for the second cluster (C2 and C3).

[0074] The query statement for the C3 cluster separated from the associated query statement can be as follows:

[0075]

[0076]

[0077] In some embodiments, when the associated query statement is the internal association method described above, the query statement for the C3 cluster separated from the associated query statement may be as follows:

[0078]

[0079] The query statement for the C2 cluster separated from the associated query statement can be as follows:

[0080]

[0081] In the above example, the query statement for cluster C2 and the query statement for cluster C3 are split out in the associated query statement.

[0082] In some embodiments, Figure 7 As shown, the above S204 writes the query data of the second cluster into the first cluster, which may include S701-S704.

[0083] In S701, a table creation statement for the second cluster is generated according to the query statement for the second cluster;

[0084] In S702, a first table of the second cluster is generated according to the table creation statement of the second cluster;

[0085] In S703, the query data of the second cluster is stored in the first table;

[0086] In S704, the query data in the first table is written into the first cluster.

[0087] In some embodiments, the first table is a temporary table, i.e., a MySQL temporary table. A MySQL temporary table is a special MySQL table that exists during a database connection and is automatically deleted when the connection is closed. The main feature of this table is that its life cycle is temporary and is limited to the current database session or connection. In the disclosed embodiment, a temporary table is used to store query data of the second cluster. The temporary table can be automatically deleted after use, and the user does not need to delete it separately, thereby avoiding data redundancy caused by the user forgetting to delete the table.

[0088] In some embodiments, the above S704 of writing the query data in the first table into the first cluster includes: writing the query data in the first table into a second table in the first cluster, wherein the second table may be a temporary table.

[0089] The above S205 queries the first cluster through the associated query statement to obtain the query result of the associated query statement, including: based on the table structure information of the first cluster, modifying the query statement for the second cluster in the associated query statement to a query statement for the second table to obtain a target query statement; after writing the query data in the first table into the second table in the first cluster, querying the first cluster through the target query statement to obtain the query result of the associated query statement.

[0090] During the entire query process of the disclosed embodiment, it is only necessary to write the query data of the second cluster into the second table of the first cluster, and the subsequent associated query operation can be completed within the first cluster. Compared with importing the full amount of data of the table to be queried in the second cluster into the first cluster, the amount of data imported during the query process is reduced, and the query efficiency is improved. In addition, the second table uses a temporary table, and the user does not need to delete it separately, avoiding data redundancy caused by the user forgetting to delete the table.

[0091] As an example, the associated query statement may be the associated query statement of the internal association form described above. When querying in S205, the name of the cohesive association table in the associated query statement will change, and the part of the original associated query statement involving the associated query in the C3 cluster will become a temporary table name. The associated query statement in the example will become as follows:

[0092]

[0093]

[0094] It can be seen from the above examples that the embodiment of the present disclosure uses C3_t_bb to replace the following content in the original associated query statement in S205:

[0095]

[0096] In the above example, C3_t_bb is the name of the newly created first table in the C3 cluster, and is also the name of the corresponding second table in the C1 cluster. That is, in the embodiment of the present disclosure, the query data of the C3 cluster is written into the second table of the C1 cluster, and then the name of the table related to the C3 cluster in the associated query statement is replaced with the name of the second table, and then the replaced associated query statement is used to query in the C1 cluster to obtain the query result of the associated query statement.

[0097] In some embodiments, the number of second tables in the first cluster is the same as the number of first tables in the second cluster.

[0098] In some embodiments, the second cluster includes multiple tables to be queried; the above S302 generates the first table of the second cluster according to the table creation statement of the second cluster, and can generate multiple first tables according to the table creation statement of the second cluster, each first table is used to store query data of a table to be queried.

[0099] In the above example, the table creation statement for the C3 cluster can be as follows:

[0100]

[0101]

[0102] As can be seen from the above example, two first tables are constructed for the C3 cluster, namely the temporary bank card table and the temporary repayment table, wherein the temporary bank card table is used to store the query data of the bank table to be queried, and the temporary repayment table is used to store the query data of the repayment table to be queried.

[0103] In some embodiments, the second cluster includes multiple tables to be queried; the above S302 generates a first table of the second cluster according to the table creation statement of the second cluster, and can generate a first table according to the table creation statement of the second cluster, and the first table is used to store query data of multiple tables to be queried.

[0104] In the above example, the table creation statement for the C3 cluster can be as follows:

[0105]

[0106] It can be seen from the above example that a first table, namely the temporary cohesive bb table, is constructed for the C3 cluster, wherein the temporary cohesive bb table is used to store query data of the to-be-queried tables bank table and repayment table.

[0107] In some embodiments, the table creation statement for the C2 cluster may be as follows:

[0108]

[0109]

[0110] In the above example, there is only one table to be queried in the C2 cluster, so only one first table needs to be constructed for the C2 cluster.

[0111] In the disclosed embodiment, different table creation statements are adaptively constructed according to the form of the query statement for the second cluster in the associated query statement. When the second cluster includes multiple tables to be queried and the query statements for the multiple tables to be queried are query statements in an associated form, a first table is constructed. The number of tables in the above scheme corresponds to the number of tables to be queried involved in the associated query statement, thereby making it simpler to modify the associated query statement and easier to query in the first cluster.

[0112] In some embodiments, the above S202 splits the query statement for the second cluster from the associated query statement, including: based on the associated query statement, analyzing the association key between the clusters to be associated, the table to be queried of each second cluster, and the corresponding query condition; based on the association key corresponding to each second cluster, the table to be queried of the second cluster, and the corresponding query condition, constructing the query statement for the second cluster.

[0113] A key is a field or a set of fields that are used to connect two or more tables. As an example, between the Orders table and the Customers table, the customer's ID might be the key.

[0114] Query conditions are the criteria used to filter the result set. These conditions can be based on any number of fields and can include logical operators (such as AND, OR) to combine different conditions.

[0115] In some embodiments, the cluster to be queried in the associated query statement includes the first cluster, that is, the multiple tables to be queried involved in the associated query statement are distributed in the first cluster and the second cluster, that is, there are tables to be queried in the first cluster.

[0116] In the disclosed embodiment, the associated query statement is split into query statements for the second cluster, that is, the large query is split into multiple small queries, which can reduce the complexity of a single query and make each query easier to manage and debug. This helps to reduce complex operations in the query execution plan and improve execution efficiency. In addition, the split query statements can be executed asynchronously, thereby relieving system pressure when processing large data sets and allowing long-running tasks to be processed in the background without affecting the front-end user experience.

[0117] Figure 8 A flow chart of a data query method in an embodiment of the present disclosure is shown as follows: Figure 8 As shown, the data query method provided in the embodiment of the present disclosure includes S801-S807, wherein S803-S807 are similar to S201-S205 of the above embodiment and will not be repeated here.

[0118] In S801, the table structure information of the cluster to be associated is obtained;

[0119] In S802, the table structure information of the cluster to be associated is displayed on the input interface of the associated query statement; wherein the table structure information is used to determine whether the table to be queried in the associated query statement belongs to the first cluster or the second cluster.

[0120] In some embodiments, displaying the table structure information of the cluster to be associated in the input interface of the associated query statement can be in response to the statement writing operation, displaying the associated query statement being written, and when writing to the data table, displaying the table structure information of the database cluster to which the data table belongs.

[0121] In the disclosed embodiment, the user can determine whether the table to be queried in the associated query statement belongs to the main cluster or the corresponding non-main cluster according to the table structure information, which facilitates the user to write the associated query statement and improves the writing efficiency of the associated query statement.

[0122] Fig. 9 A data query process diagram according to an embodiment of the present disclosure is shown. Fig. 9 As shown in the figure, suppose the user wants to perform an associated query on the table in MySQL cluster C1 and the table in MySQL cluster C2 to obtain the query result. The query process is as follows:

[0123] First, the user needs to select a cluster as the primary associated cluster. Assume that the user selects C2.

[0124] Next, the user needs to go to the C1 cluster to obtain the data to be associated with the C2 cluster. Specifically, you can first "query" and verify the data in the C1 cluster through "internal association and query conditions". Then "export" the filtered part or all of the data in the C1 cluster.

[0125] If the user logic uses part of the filtered data, you may need to write a new table creation statement and create it in the C2 cluster, that is, "write a table creation statement".

[0126] The data exported from the C1 cluster is then "imported" or written into the C2 cluster.

[0127] Then the user "writes the associated query statement" and "queries" the data in the C2 cluster. Only then can the query "result" of the associated data be obtained.

[0128] After the query is completed, the user also needs to perform a "trigger table deletion" to "delete" the tables and data imported into the C2 cluster.

[0129] In addition, if the user needs to associate C3 or more clusters, it is necessary to repeat the above data export and import steps in C3 or more clusters, and perform association queries after exporting and importing more data.

[0130] In the above solution, users need to export and import data from different clusters multiple times, which is very time-consuming. In order to reduce the difficulty, users often export all table structures and data involved in the C1 and C3 clusters as shown in the figure. This can reduce the risk of repeated data export due to insufficient consideration of factors; most of the exported data may not be used, and they must be written to the C2 cluster before they can be used, which often causes a sharp increase in data volume. In addition, when importing data and tables into the C2 cluster for storage in the above solution, it often consumes a lot of system resources such as disk IO, CPU, and memory. If there are slave nodes, binlog logs must also be written and synchronized to each slave node for writing, which consumes a lot of resources.

[0131] In addition, after querying the data, users sometimes forget to delete the tables imported into C2 for the above-mentioned associated queries, resulting in some useless redundant data in the C2 cluster.

[0132] Fig.10A schematic diagram of a data query platform in an embodiment of the present disclosure is shown. The data query method in an embodiment of the present disclosure can be performed by Fig.10 The query platform in is executed. The specific data query process is as follows:

[0133] First, the user needs to "Select Cluster", select the cluster to be associated, such as C1, C2, C3, and select C2 as the main cluster.

[0134] Then the "Query Platform" will cache the table structure information of the C1, C2, and C3 clusters selected by the user through the "Cache Cluster Table Information" and prompt the cluster information to which the specified table belongs during query.

[0135] Then the user "writes the associated query statement" on the interface provided by the platform. The user can easily identify the table ownership through the "cached" table structure information, which is almost the same experience as the associated query within the same cluster. Figure 8 Steps S801-S802 in the embodiment.

[0136] After the user "submits" the query statement, the "query platform" uses the "split query" function to split the associated query. In addition to the main cluster selected in the above steps, the queries of other clusters will be split into one or more query SQL statements, and data will be queried in the corresponding clusters respectively. In other words, the associated query statement is split into the query statement corresponding to the second cluster.

[0137] Then, the "query platform" automatically generates new table creation statements for the query results of each cluster through "writing data to memory table" and writes the data to the main cluster. Among them, the table created by the table creation statement is a "MySQL temporary table".

[0138] Finally, the "query platform" queries the associated statements written by the user in the main cluster in the "associated query" and feeds back the query "results" to the user until the user closes the page or disconnects.

[0139] The disclosed embodiments can improve the timeliness of cluster association queries, reduce redundant data in the database, and reduce database resource overhead.

[0140] In the embodiments of the present disclosure, the terms “first”, “second” and “third” are used for descriptive purposes only and should not be understood as indicating or implying relative importance.

[0141] The term "and / or" in this disclosure is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0142] Furthermore, although the steps of the method in the present disclosure are described in a particular order in the drawings, this does not require or imply that the steps must be performed in this particular order or that all the steps shown must be performed to achieve the desired results.

[0143] In some embodiments, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0144] Based on the same inventive concept, the present disclosure also provides a message transmission device in the following embodiments. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.

[0145] Fig.11 A schematic diagram of a data query device in an embodiment of the present disclosure is shown. Fig.11 As shown, the data query device includes a statement acquisition module 1101, a statement splitting module 1102, a first query module 1103, a data writing module 1104 and a second query module 1105.

[0146] A statement acquisition module 1101 is used to acquire an associated query statement, where the associated query statement is used to perform an associated query in the clusters to be associated, where the clusters to be associated include a first cluster and a second cluster;

[0147] The statement splitting module 1102 is used to split the query statement for the second cluster from the associated query statement:

[0148] A first query module 1103 is used to query the second cluster through a query statement of the second cluster to obtain query data of the second cluster;

[0149] A data writing module 1104 is used to write the query data of the second cluster into the first cluster;

[0150] The second query module 1105 is configured to query the first cluster through an associated query statement to obtain a query result of the associated query statement.

[0151] In some embodiments, the data writing module 1104 is used to generate a table creation statement for the second cluster according to the query statement of the second cluster; generate a first table for the second cluster according to the table creation statement of the second cluster; store the query data of the second cluster into the first table; and write the query data in the first table into the first cluster.

[0152] In some embodiments, the second cluster includes multiple tables to be queried; generating the first table of the second cluster according to the table creation statement of the second cluster includes: generating multiple first tables according to the table creation statement of the second cluster, each first table is used to store query data of a table to be queried.

[0153] In some embodiments, the second cluster includes multiple tables to be queried; generating a first table of the second cluster according to the table creation statement of the second cluster includes: generating a first table according to the table creation statement of the second cluster, the first table is used to store query data of the multiple tables to be queried.

[0154] In some embodiments, writing the query data in the first table into the first cluster includes: writing the query data in the first table into a second table in the first cluster;

[0155] The second query module 1105 is used to modify the query statement for the second cluster in the associated query statement into a query statement for the second table based on the table structure information of the first cluster to obtain a target query statement; after writing the query data in the first table into the second table in the first cluster, query the first cluster through the target query statement to obtain the query result of the associated query statement.

[0156] In some embodiments, the statement splitting module 1102 is used to analyze and obtain the association keys between the clusters to be associated, the table to be queried of each second cluster, and the corresponding query conditions based on the association query statement; and construct the query statement of the second cluster based on the association keys corresponding to each second cluster, the table to be queried of the second cluster, and the corresponding query conditions.

[0157] In some embodiments, the data query device includes a table structure display module.

[0158] The table structure display module is used to obtain the table structure information of the cluster to be associated before obtaining the associated query statement; and display the table structure information of the cluster to be associated on the input interface of the associated query statement;

[0159] The table structure information is used to determine whether the table to be queried in the associated query statement belongs to the first cluster or the second cluster.

[0160] The concepts of “first”, “second”, etc. mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0161] Regarding the data query device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the data query method, and will not be elaborated here.

[0162] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, such division is not mandatory.

[0163] In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0164] Some of the blocks shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0165] Refer to the following Fig.12 To describe the electronic device provided by the embodiment of the present disclosure. Fig.12 The electronic device 1200 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0166] Fig.12 FIG. 1 is a schematic diagram showing the architecture of an electronic device 1200 provided by an embodiment of the present disclosure. Fig.12 As shown, the electronic device 1200 includes but is not limited to: at least one processor 1210 and at least one memory 1220 .

[0167] The memory 1220 is used to store instructions.

[0168] In some embodiments, the memory 1220 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 12201 and / or a cache memory unit 12202 , and may further include a read-only memory unit (ROM) 12203 .

[0169] In some embodiments, memory 1220 may also include a program / utility 12204 having a set (at least one) of program modules 12205, such program modules 12205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0170] In some embodiments, the memory 1220 may store an operating system, which may be a real-time operating system (RTX), LINUX, UNIX, WINDOWS, or OS X.

[0171] In some embodiments, data may also be stored in the memory 1220 .

[0172] As an example, the processor 1210 may read data stored in the memory 1220 , where the data may be stored at the same storage address as the instruction, or the data may be stored at a different storage address than the instruction.

[0173] The processor 1210 is used to call the instructions stored in the memory 1220 to implement the steps of various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification. For example, the processor 1210 can execute the steps of the above data query method embodiment.

[0174] It should be noted that the processor 1210 may be a general-purpose processor or a special-purpose processor. The processor 1210 may include one or more processing cores, and the processor 1210 executes various functional applications and data processing by running instructions.

[0175] In some embodiments, processor 1210 may include a central processing unit (CPU) and / or a baseband processor.

[0176] In some embodiments, the processor 1210 may determine an instruction according to the priority identifier and / or function category information carried in each control instruction.

[0177] In the present disclosure, the processor 1210 and the memory 1220 may be provided separately or integrated together.

[0178] As an example, the processor 1210 and the memory 1220 may be integrated on a single board or a system on chip (SOC).

[0179] like Fig.12 As shown, the electronic device 1200 is in the form of a general-purpose computing device. The electronic device 1200 may further include a bus 1230 .

[0180] The bus 1230 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures.

[0181] The electronic device 1200 may also communicate with one or more external devices 1240 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device 1200, and / or any device that enables the electronic device 1200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 1250.

[0182] Furthermore, the electronic device 1200 can also communicate with one or more networks (eg, a local area network (LAN), a wide area network (WAN) and / or a public network, such as the Internet) through the network adapter 1260 .

[0183] like Fig.12 As shown, the network adapter 1260 communicates with other modules of the electronic device 1200 via the bus 1230 .

[0184] It should be understood that although not shown in the figures, other hardware and / or software modules may be used in conjunction with the electronic device 1200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0185] It is understood that the structure shown in the embodiment of the present disclosure does not constitute a specific limitation on the electronic device 1200. In other embodiments of the present disclosure, the electronic device 1200 may include: Fig.12 More or fewer components may be shown, or some components may be combined or separated, or the components may be arranged differently. Fig.12 The components shown may be implemented in hardware, software or a combination of software and hardware.

[0186] The present disclosure also provides a computer-readable storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, the data query method described in the above method embodiment is implemented.

[0187] The computer-readable storage medium in the embodiments of the present disclosure is a computer instruction that can be sent, propagated or transmitted for use by or in conjunction with an instruction execution system, apparatus or device.

[0188] As one example, computer readable storage media are non-volatile storage media.

[0189] In some embodiments, more specific examples of computer-readable storage media in the present disclosure may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, a USB flash drive, a mobile hard disk, or any suitable combination of the foregoing.

[0190] In the embodiments of the present disclosure, the computer-readable storage medium may include a data signal propagated in a baseband or as a part of a carrier wave, in which computer instructions (readable program codes) are carried.

[0191] Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.

[0192] In some examples, computing instructions contained on a computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0193] The embodiments of the present disclosure also provide a computer program product, which stores instructions. When the instructions are executed by a computer, the computer implements the data query method described in the above method embodiment.

[0194] The above instructions may be program codes. In specific implementation, the program codes may be written in any combination of one or more programming languages.

[0195] The programming language includes object-oriented programming languages, such as Java, C++, etc., and also includes conventional procedural programming languages, such as "C" language or similar programming languages.

[0196] The program code may execute entirely on the user's computing device, partly on the user's computing device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device or entirely on the remote computing device or server.

[0197] Where a remote computing device is involved, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0198] The embodiment of the present disclosure also provides a chip, including at least one processor and an interface;

[0199] An interface for providing program instructions or data to at least one processor;

[0200] At least one processor is used to execute program instructions to implement the data query method described in the above method embodiment.

[0201] In some embodiments, the chip may further include a memory, which is used to store program instructions and data, and the memory is located inside or outside the processor.

[0202] Those skilled in the art will appreciate that all or part of the steps for implementing the above embodiments may be implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits", "modules" or "systems".

[0203] Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein.

[0204] The present disclosure is intended to cover any variation, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not disclosed in the present disclosure. The description and examples are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.

Claims

1. A data query method, characterized in that: include: Obtaining an associated query statement, where the associated query statement is used to perform an associated query in the clusters to be associated, where the clusters to be associated include a first cluster and a second cluster; Split the query statement for the second cluster from the associated query statement: querying the second cluster by using the query statement of the second cluster to obtain query data of the second cluster; Writing query data of the second cluster into the first cluster; The first cluster is queried through the associated query statement to obtain a query result of the associated query statement.

2. The method according to claim 1, characterized in that Writing the query data of the second cluster into the first cluster includes: generating a table creation statement for the second cluster according to the query statement for the second cluster; Generate a first table of the second cluster according to the table creation statement of the second cluster; storing the query data of the second cluster into the first table; The query data in the first table is written into the first cluster.

3. The method according to claim 2, characterized in that The second cluster includes a plurality of tables to be queried; and generating a first table of the second cluster according to a table creation statement of the second cluster includes: A plurality of the first tables are generated according to the table creation statement of the second cluster, and each of the first tables is used to store query data of one of the tables to be queried.

4. The method according to claim 2, characterized in that: The second cluster includes a plurality of tables to be queried; and generating a first table of the second cluster according to a table creation statement of the second cluster includes: A first table is generated according to the table creation statement of the second cluster, and the first table is used to store query data of the multiple tables to be queried.

5. The method according to claim 2, characterized in that: Writing the query data in the first table into the first cluster includes: Writing the query data in the first table into a second table in the first cluster; The querying the first cluster by using the associated query statement to obtain the query result of the associated query statement includes: based on the table structure information of the first cluster, modifying the query statement for the second cluster in the associated query statement to a query statement for the second table to obtain a target query statement; After the query data in the first table is written into the second table in the first cluster, the first cluster is queried through the target query statement to obtain a query result of the associated query statement.

6. The method according to claim 1, characterized in that The cluster to be queried in the associated query statement includes the first cluster, and the step of separating a query statement for the second cluster from the associated query statement includes: Based on the association query statement, analyzing and obtaining the association key between the clusters to be associated, the table to be queried of each second cluster, and the corresponding query condition; A query statement for the second cluster is constructed based on the association key corresponding to each second cluster, the to-be-queried table of the second cluster, and the corresponding query condition.

7. The method according to claim 1, characterized in that Before obtaining the associated query statement, the method further includes: Obtaining table structure information of the cluster to be associated; On the input interface of the association query statement, display the table structure information of the cluster to be associated; The table structure information is used to determine whether the table to be queried in the associated query statement belongs to the first cluster or the second cluster.

8. A data query device, characterized in that: include: A statement acquisition module, used for acquiring an associated query statement, wherein the associated query statement is used for performing an associated query in a cluster to be associated, wherein the cluster to be associated includes a first cluster and a second cluster; A statement splitting module is used to split the query statement for the second cluster from the associated query statement: A first query module, configured to query the second cluster using a query statement of the second cluster to obtain query data of the second cluster; A data writing module, used for writing the query data of the second cluster into the first cluster; The second query module is used to query the first cluster through the associated query statement to obtain a query result of the associated query statement.

9. An electronic device, characterized in that: include: A memory for storing instructions; A processor is used to call the instructions stored in the memory to implement the data query method according to any one of claims 1 to 7.

10. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed by a processor, the data query method described in any one of claims 1 to 7 is implemented.