Query method, device, computer equipment and storage medium

By obtaining the associated information of the data table and determining the query strategy based on it, the problem of low query efficiency in the big data business platform is solved, and more efficient and economical data query is achieved.

CN117909550BActive Publication Date: 2025-02-14DAWNING CLOUD COMPUTING TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311758717.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-20
Publication Date
2025-02-14
Estimated Expiration
2043-12-20

AI Technical Summary

Technical Problem

Data query efficiency based on big data business platforms is low, making it difficult to quickly and accurately obtain target data in massive data.

Method used

By obtaining the associated information of the data table where the information to be queried is located, determining the query strategy based on the associated information, and selecting one of the statement query method, index query method or engine query method to query.

Benefits of technology

It improves query efficiency, reduces query costs, and adapts to query needs of different data scales and scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117909550B_ABST
    Figure CN117909550B_ABST
Patent Text Reader

Abstract

The present application relates to a query method, device, computer equipment and storage medium. The method first obtains the associated information of the data table where the information to be queried is located, then determines the query strategy based on the associated information, and finally queries the information to be queried in the data table according to the query strategy to obtain the query result. Among them, the query strategy includes one of a statement query method, an index query method, and an engine query method. The above method determines the query strategy by analyzing the associated information of the information to be queried, and can flexibly select the most suitable query method for different scenarios of the associated information. The index query method and the engine query method are introduced. When the data scale is large, the problem of low efficiency of the statement query method can be improved to maximize the query efficiency. At the same time, the query cost can also be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a query method, apparatus, computer device and storage medium. Background Art

[0002] With the rapid development of technologies such as the Internet, cloud computing, and the Internet of Things, there are massive amounts of heterogeneous data on business platforms in different fields such as finance, medical care, and retail. It is particularly important to quickly and accurately obtain target data from massive amounts of data in the tens of millions or billions.

[0003] At present, there are many query methods for data query based on big data business platforms, such as full-text search, data mining, and the use of various algorithm models and big data components for complex data query and analysis.

[0004] However, the above query method has the problem of low query efficiency. Summary of the invention

[0005] Based on this, it is necessary to provide a query method, device, computer equipment and storage medium that can improve query efficiency in response to the above technical problems.

[0006] In a first aspect, the present application provides a query method, the method comprising:

[0007] Obtain the associated information of the data table where the information to be queried is located;

[0008] Determine a query strategy based on the associated information; the query strategy includes one of a statement query method, an index query method, and an engine query method;

[0009] The information to be queried is queried in the data table according to the query strategy to obtain the query result.

[0010] The query method provided in the embodiment of the present application first obtains the associated information of the data table where the information to be queried is located, then determines the query strategy based on the associated information, and finally queries the information to be queried in the data table according to the query strategy to obtain the query result. Among them, the query strategy includes one of a statement query method, an index query method, and an engine query method. The above method determines the query strategy by analyzing the associated information of the information to be queried, and can flexibly select the most suitable query method for different scenarios of the associated information. The index query method and the engine query method are introduced. When the data scale is large, the problem of low efficiency of the statement query method can be improved to maximize the query efficiency. At the same time, the query cost can also be reduced.

[0011] In one embodiment, determining a query strategy according to the association information includes:

[0012] Determine the data storage scale of the data table based on the associated information of the data table;

[0013] If the data storage scale meets the preset scale requirement, the query strategy is determined to be the statement query mode;

[0014] If the data storage scale does not meet the preset scale requirement, the query strategy is determined to be one of the index query method, the engine query method and the statement query method.

[0015] The method described in the embodiment of the present application can improve the query execution efficiency and flexibility, and avoid the waste of resources caused by unnecessary query method selection by determining whether the data storage scale meets the preset scale requirement, and then selecting the optimal query strategy according to different data storage scale situations.

[0016] In one embodiment, determining the query strategy as one of an index query mode, an engine query mode, and a statement query mode includes:

[0017] According to the association information of the data table, determine whether the data table has been bound to the query engine;

[0018] If it is determined that the data table has been bound to a query engine, the query strategy is determined to be the engine query mode;

[0019] If it is determined that the data table is not bound to a query engine, the query strategy is determined to be an index query method or a statement query method according to the index field in the associated information.

[0020] The method described in the embodiment of the present application can improve the query execution efficiency and flexibility and avoid the waste of resources caused by unnecessary query method selection by determining whether the data table is bound to the query engine and then selecting the optimal query strategy.

[0021] In one embodiment, determining the query strategy as an index query method or a statement query method according to the index field in the association information includes:

[0022] Determine whether the information to be queried is in the index field;

[0023] If the information to be queried is in the index field, the query strategy is determined to be the index query mode;

[0024] If the information to be queried is not in the index field, the query strategy is determined to be a statement query mode.

[0025] The method described in the embodiment of the present application can improve the query execution efficiency and flexibility and avoid the waste of resources caused by unnecessary query method selection by determining whether the information to be queried is in the index field and then selecting the optimal query strategy.

[0026] In one embodiment, the query strategy is a statement query method or an index query method. After the query strategy is used to query the information to be queried in the data table and the query result is obtained, the method further includes:

[0027] Determine the query efficiency occupied by querying the information to be queried;

[0028] If the query efficiency is less than the preset efficiency threshold, the target query engine is bound to the data table, the data contained in the data table is synchronized to the target query engine, and the binding information in the associated information is updated.

[0029] The method described in the embodiment of the present application can evaluate and analyze the query performance by determining whether the query efficiency other than the engine query method meets the preset efficiency threshold, and improve the efficiency by binding the target query engine when the query efficiency is not ideal. The above-mentioned method of selecting the engine according to the needs can avoid unnecessary waste of resources and further optimize resource utilization.

[0030] In one embodiment, the method further comprises:

[0031] In response to a query instruction input by a user in a query interface, a step of acquiring associated information of a data table where the information to be queried is located is executed; the query instruction includes the identifiers of the information to be queried and the data table.

[0032] The method described in the embodiments of the present application can realize human-computer interaction by setting a query interface.

[0033] In one embodiment, obtaining the associated information of the data table where the information to be queried is located includes:

[0034] According to the identifier of the data table, the associated information of the data table where the information to be queried is located is extracted from the preset auxiliary table; the preset auxiliary table includes the associated information of multiple data tables; the associated information includes the data storage scale of the corresponding data table, the index field of the data table, the binding information of the data table, and the identifier of the data table.

[0035] The method described in the embodiment of the present application can simplify the query process by constructing a preset auxiliary table and extracting the associated information of the data table from the preset auxiliary table, avoiding the need for users to manually search for the associated information of the data table, improving the query accuracy and efficiency, and facilitating data updating and maintenance.

[0036] In a second aspect, the present application further provides a query device, the device comprising:

[0037] The acquisition module is used to obtain the associated information of the data table where the information to be queried is located;

[0038] A first determination module is used to determine a query strategy according to the associated information; the query strategy includes one of a statement query method, an index query method, and an engine query method;

[0039] The query module is used to query the information to be queried in the data table according to the query strategy to obtain the query result.

[0040] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:

[0041] Obtain the associated information of the data table where the information to be queried is located;

[0042] Determine a query strategy based on the associated information; the query strategy includes one of a statement query method, an index query method, and an engine query method;

[0043] The information to be queried is queried in the data table according to the query strategy to obtain the query result.

[0044] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0045] Obtain the associated information of the data table where the information to be queried is located;

[0046] Determine a query strategy based on the associated information; the query strategy includes one of a statement query method, an index query method, and an engine query method;

[0047] The information to be queried is queried in the data table according to the query strategy to obtain the query result.

[0048] In a fifth aspect, the present application further provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0049] Obtain the associated information of the data table where the information to be queried is located;

[0050] Determine a query strategy based on the associated information; the query strategy includes one of a statement query method, an index query method, and an engine query method;

[0051] The information to be queried is queried in the data table according to the query strategy to obtain the query result.

[0052] The above-mentioned query method, device, computer equipment and storage medium, the method first obtains the associated information of the data table where the information to be queried is located, then determines the query strategy based on the associated information, and finally queries the information to be queried in the data table according to the query strategy to obtain the query result. Among them, the query strategy includes one of a statement query method, an index query method, and an engine query method. The above-mentioned method determines the query strategy by analyzing the associated information of the information to be queried, and can flexibly select the most suitable query method for different scenarios of the associated information to maximize the query efficiency, and at the same time, it can also reduce the query cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 is an internal structure diagram of a computer device in one embodiment;

[0054] Figure 2 A flowchart of a query method in an embodiment;

[0055] Figure 3 is a flowchart of a query method in another embodiment;

[0056] Figure 4 is a flowchart of a query method in another embodiment;

[0057] Figure 5 is a flowchart of a query method in another embodiment;

[0058] Figure 6 is a flowchart of a query method in another embodiment;

[0059] Figure 7 is a flowchart of a query method in another embodiment;

[0060] Figure 8 is a flowchart of a query method in another embodiment;

[0061] Fig. 9 is a flowchart of a query method in another embodiment;

[0062] Fig.10 is a structural block diagram of a query device in an embodiment;

[0063] Fig.11 is a structural block diagram of a query device in another embodiment;

[0064] Fig.12 It is a structural block diagram of a query device in another embodiment. DETAILED DESCRIPTION

[0065] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0066] With the rapid development of technologies such as the Internet, cloud computing, and the Internet of Things, there are massive amounts of heterogeneous data on business platforms in different fields such as finance, medical care, and retail. How to quickly and accurately obtain target data from massive amounts of data in the tens of millions or hundreds of millions is particularly important. At present, there are many query methods for data query based on big data business platforms, such as full-text search, data mining, and the use of various algorithm models and big data components for complex data query analysis. However, the above query method has the problem of low query efficiency. The present application provides a query method that aims to solve the above technical problems. The following embodiments will specifically illustrate the query method described in the present application.

[0067] The query method provided in the embodiment of the present application can be applied to Figure 1 In the computer device shown in the figure, the computer device can be a terminal or a server. In this embodiment, the computer device can be a query platform, and its internal structure diagram can be as shown in FIG. Figure 1 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a query method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0068] Those skilled in the art will understand that Figure 1The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0069] In one embodiment, Figure 2 As shown, a query method is provided, which is applied to Figure 1 The computer device in the example is used to illustrate, including the following steps:

[0070] S101, obtaining the associated information of the data table where the information to be queried is located.

[0071] The information to be queried is data information in a data table, and includes the identifier of the data table where the information to be queried is located, the identifier of the database where the data table is located, and the identifier of the data source where the database is located. The associated information of the data table includes the total amount of data in the data table, the data storage capacity of the data table, the index field of the data table, the identifier of the data table, and the binding information of the data table, and the binding information of the data table is at least one of whether to bind to the query engine, etc.

[0072] In the embodiment of the present application, the computer device can construct a statistical auxiliary table in advance according to the relationship between the data source, the database and the data table, which is used to record the data information in each data table. Optionally, the data rows in the statistical auxiliary table correspond to the data information of a data table. The computer device can receive the query information input by the user in the query interface of the computer device, and specifically can receive the query information selected by the user through the selection box in the query interface. Optionally, it can also receive the query information directly input by the user in the query interface, and can also receive the query information selected by the user through the sliding component in the query interface. For example, the user can first select the data source to be queried from multiple data sources, and then select the database to be queried from multiple databases of the data source to be queried, and then select the data table to be queried from multiple data tables of the database to be queried, and finally select the information to be queried from the data table to be queried. Specifically, the information to be queried can be selected from the data table to be queried through the query condition, and the query condition can include at least one of the filter field, the filter condition, the filter value and the sorting field. After receiving the query information input by the user in the query interface of the computer device, the computer device can determine the data table where the information to be queried is located according to the information to be queried, and then obtain the data information of the data row corresponding to the data table from the statistical auxiliary table, and use it as the association information of the data table. Since the query statements for different types of databases are different, when determining the data table, you can first determine the type of database, and then determine the data table through the statement corresponding to the database type. For different databases, such as MySQL, PostgreSQL, and Oracle, the way to obtain the associated information of the data table is as follows: Figure 3 shown.

[0073] S102: Determine a query strategy according to the associated information.

[0074] Among them, the query strategy includes one of the following: statement query method, index query method, and engine query method. The statement query method can be a conventional statement query method, such as a conventional SQL query, which is characterized by low cost and fast query speed when the amount of data to be queried is small. The index query method can cover the index method, which is an optimized statement query method, which is characterized by fast query speed when the amount of data reaches a certain scale, and relatively high cost. The engine query method uses a query engine to query information, which is characterized by fast query speed and high efficiency when the amount of data is huge, and high cost.

[0075] In the embodiment of the present application, the computer device can design different query strategies in advance according to the data information of the data table. After obtaining the associated information of the data table where the information to be queried is located, the computer device can first determine the amount of data corresponding to the associated information, and then determine which amount of data meets the requirements of the amount of data corresponding to which query strategy, and then determine the appropriate query strategy. Specifically, when the amount of data is small, the query strategy can be determined to be a statement query method. In this scenario, the computer device does not need a complex index or engine. When the amount of data reaches a certain scale, the query strategy is determined to be an index query method. In this scenario, the computer device can directly search for data that meets the query conditions through the index without scanning the entire data table. When the amount of data is huge, the query strategy is determined to be an engine query method. In this scenario, the computer device can query in parallel through engine query technology. For example, parallel processing, distributed computing and other technologies can be used to accelerate query operations by decomposing the query task into multiple subtasks and using multiple devices for parallel processing.

[0076] S103, querying the information to be queried in the data table according to the query strategy to obtain the query result.

[0077] The query result is the result corresponding to the information to be queried.

[0078] In an embodiment of the present application, after determining the query strategy, the computer device can query the information to be queried in the data table according to the query strategy to obtain the query result corresponding to the information to be queried. Optionally, the query result can be displayed on the query interface of the computer device. Specifically, after determining that the query strategy is a statement query mode, a query statement can be constructed according to the information to be queried, and then data query can be performed according to the query statement to obtain the query result. After determining that the query strategy is an index query mode, a query statement can be constructed according to the information to be queried and the index information, and then data query can be performed according to the query statement to obtain the query result. After determining that the query strategy is an engine query mode, the query engine can be determined first, and then data query can be performed according to the query information and the query engine to obtain the query result.

[0079] The query method provided in the embodiment of the present application first obtains the associated information of the data table where the information to be queried is located, then determines the query strategy based on the associated information, and finally queries the information to be queried in the data table according to the query strategy to obtain the query result. Among them, the query strategy includes one of a statement query method, an index query method, and an engine query method. The above method determines the query strategy by analyzing the associated information of the information to be queried, and can flexibly select the most suitable query method for different scenarios of the associated information. The index query method and the engine query method are introduced. When the data scale is large, the problem of low efficiency of the statement query method can be improved to maximize the query efficiency. At the same time, the query cost can also be reduced.

[0080] In one embodiment, a specific implementation method for obtaining a query strategy is also provided, such as Figure 4 As shown, the "determining a query strategy according to associated information" in the above step S102 includes:

[0081] S201, determining the data storage scale of the data table according to the association information of the data table.

[0082] S202, determining whether the data storage scale of the data table meets the preset scale requirement, if yes, executing step S2021, if not, executing step S2022;

[0083] S2021, determine that the query strategy is a statement query method.

[0084] S2022: Determine the query strategy as one of an index query method, an engine query method, and a statement query method.

[0085] Among them, the data storage scale includes the total amount of data in the data table and the data storage capacity of the data table. The data storage scale meets the preset scale requirement, which means that the total amount of data in the data table is less than or equal to the preset total amount of data threshold, and the data storage capacity of the data table is less than or equal to the preset data storage capacity threshold. The data storage scale does not meet the preset scale requirement, which means that at least one of the total amount of data in the data table or the data storage capacity of the data table is greater than the corresponding threshold requirement, including three scenarios: the first scenario is that the total amount of data is greater than the preset total amount of data threshold, and the data storage capacity is less than or equal to the preset data storage capacity threshold; the second scenario is that the data storage capacity is greater than the preset data storage capacity threshold, and the total amount of data is less than or equal to the preset total amount of data threshold; the third scenario is that the data storage capacity is greater than the preset data storage capacity threshold, and the total amount of data is greater than the preset total amount of data threshold.

[0086] In the embodiment of the present application, after the computer device obtains the association information of the data table based on the above steps, the total amount of data in the data table and the data storage capacity of the data table can be determined from the association information. Figure 3The statement in obtains the total amount of data in the data table and the data storage capacity of the data table. After obtaining the data storage scale, the computer device can compare the data storage scale with the preset scale requirement to determine whether the data storage scale meets the preset scale requirement. Specifically, it can determine whether the total amount of data in the data table meets the preset data total amount threshold, and determine whether the data storage capacity of the data table meets the preset data storage capacity threshold. If the data storage scale meets the preset scale requirement, this scenario indicates that the current data scale is small, and the query strategy can be determined as the statement query method, that is, the statement query method is directly used for data query. For example, suppose there is a data table named "users" that stores user information, including "ID", "name" and "age" fields, and the user wants to query the user information whose age is greater than or equal to 18 years old. Then the query process can be: first construct a query statement, such as "SELECT*FROM users WHERE age>=18", and then send the query statement to the data table, the data table parses and executes the statement, and returns the query results of the user information that meets the conditions, such as user ID, name and age. If the data storage scale does not meet the preset scale requirement, this scenario indicates that the current data scale is large, and the query strategy can be determined as the index query method, or the engine query method, or the statement query method.

[0087] The method described in the embodiment of the present application can improve the query execution efficiency and flexibility, and avoid the waste of resources caused by unnecessary query method selection by determining whether the data storage scale meets the preset scale requirement, and then selecting the optimal query strategy according to different data storage scale situations.

[0088] In one embodiment, another specific implementation method for obtaining the query strategy is also provided, such as Figure 5 As shown, the "determining the query strategy to be one of the index query mode, the engine query mode and the statement query mode" in the above step S2022 includes:

[0089] S301, determining whether the data table has been bound to the query engine according to the association information of the data table, if it has been bound, executing step S3011, if it has not been bound, executing step S3012;

[0090] S3011, determine that the query strategy is the engine query mode.

[0091] S3012: Determine, according to the index field in the association information, whether the query strategy is an index query method or a statement query method.

[0092] In an embodiment of the present application, after the computer device obtains the association information of the data table based on the above steps, it can determine the binding information of the data table from the association information, that is, determine whether the data table is bound to the query engine. If the data table is bound to the query engine, the query strategy can be determined as the engine query mode, that is, the query engine is used to query the data. For example, suppose there is a large-scale transaction data table containing all transaction records, and the user wants to query the total amount of all transactions on a certain day. Then the query process can be: first use the distributed database query engine to distribute the query task to multiple nodes, each node processes a different subset of transaction data, and calculates the total transaction amount of its subset, and finally collects and integrates the total transaction amount results returned by each node to obtain the final query result. If the data table is not bound to the query engine, the computer device can determine the query strategy as the index query mode or the statement query mode according to the index field in the association information. Specifically, the query strategy can be determined according to the query field of the information to be queried and the index field of the association information.

[0093] The method described in the embodiment of the present application can improve the query execution efficiency and flexibility and avoid the waste of resources caused by unnecessary query method selection by determining whether the data table is bound to the query engine and then selecting the optimal query strategy.

[0094] In one embodiment, another specific implementation method for obtaining the query strategy is also provided, such as Figure 6 As shown, the above step S3012 of "determining the query strategy as an index query method or a statement query method according to the index field in the association information" includes:

[0095] S401, determine whether the information to be queried is in the index field, if the information to be queried is in the index field, execute step S4011, if the information to be queried is not in the index field, execute step S4012;

[0096] S4011, determine that the query strategy is index query mode.

[0097] S4012, determine that the query strategy is a statement query mode.

[0098] Among them, the index field is used to associate two sets of data. When querying using the index field, the computer device can obtain another set of data in the index field by querying a set of data in the index field. That is, when obtaining another set of data, there is no need to traverse all the data to search.

[0099] In an embodiment of the present application, after receiving the information to be queried and obtaining the associated information of the database where the information to be queried is located, the computer device can further extract the query field of the information to be queried and the index field of the associated information. If the query field of the information to be queried is in the index field, the query strategy can be determined as the index query method, that is, the index field is used for query. For example, suppose there is a data table called "products" that stores product information, including "ID", "name" and "price" fields. An index is created for the "price" field, and the user wants to query product information with a price lower than 100. Then the query process can be: first construct a query statement, such as "SELECT*FROM products WHERE price <100", and then the database uses the index of the price field to locate the product that meets the conditions, and returns the query result of the product information that meets the conditions. If the query field of the information to be queried is not in the index field, the query strategy can be determined as a statement query method.

[0100] The method described in the embodiment of the present application can improve the query execution efficiency and flexibility by determining whether the information to be queried is in the index field and then selecting the optimal query strategy, and can also avoid unnecessary query methods.

[0101] S106, responding to the waste of resources caused by the user inputting selections in the query interface.

[0102] In one embodiment, when the query strategy is a statement query method or an index query method, after the query strategy is used to query the information to be queried in the data table and the query result is obtained, a query method is also provided, such as Figure 7 As shown, the method described in the above embodiment also includes:

[0103] S104, determining the query efficiency occupied by querying the information to be queried.

[0104] The query efficiency may be determined based on the query time or the query time and accuracy.

[0105] In an embodiment of the present application, when the computer device determines that the query strategy is a statement query method or an index query method, and uses the statement query method or the index query method to query the query information to obtain the query result, the query efficiency of the entire query process can be further determined.

[0106] S105: If the query efficiency is less than a preset efficiency threshold, the data table is bound to a target query engine, the data contained in the data table is synchronized to the target query engine, and the binding information in the associated information is updated.

[0107] The preset efficiency threshold refers to an efficiency threshold set in advance according to business requirements. The target query engine can be the same as other bound query engines, or different from other bound query engines. The target query engine can be the Elasticsearch query engine, or other query engines.

[0108] In an embodiment of the present application, the computer device can set a preset efficiency threshold in advance according to business needs. After determining the query efficiency occupied by the query information to be queried, the query efficiency can be compared with the preset efficiency threshold. If the query efficiency is less than the preset efficiency threshold, in this scenario, it means that the query efficiency using the statement query method or the index query method is too low, then it is necessary to bind the target query engine to the data table to improve the query efficiency. After the computer device binds the target query engine to the data table, it can use the data synchronization tool Logstash to synchronize the data contained in the data table to the target query engine, and update the binding information in the associated information, for example, the original binding information is changed from the unbound query engine False to the bound query engine True, so as to ensure efficient information query next time when using the target query engine. If the query efficiency is greater than or equal to the preset efficiency threshold, in this scenario, it means that the query efficiency using the statement query method or the index query method meets the business needs, and there is no need to bind the target query engine.

[0109] The method described in the embodiment of the present application can evaluate and analyze the query performance by determining whether the query efficiency other than the engine query method meets the preset efficiency threshold, and improve the efficiency by binding the target query engine when the query efficiency is not ideal. The above-mentioned method of selecting the engine according to the needs can avoid unnecessary waste of resources and further optimize resource utilization.

[0110] In one embodiment, a query method based on a human-computer interaction interface is also provided. Figure 8 As shown, Figure 2 The method described in the embodiment also includes:

[0111] The query instruction is executed to execute the step of obtaining the associated information of the data table where the information to be queried is located.

[0112] The query interface may include an information input box, an information selection box, or an information selection component. The query instruction includes the identifier of the information to be queried and the data table.

[0113] In the embodiment of the present application, a query interface is provided on the computer device. When the user needs to perform an information query, the data source to be queried, the database to be queried, the data table to be queried, and the information to be queried can be input on the query interface. Optionally, an information selection box can also be provided on the query interface. The information selection box can include different data source information, different database information, and different data table information. The user can select the data source to be queried, the database to be queried, the data table to be queried, and the information to be queried in the information selection box. Optionally, a sliding component can also be provided on the query interface. Specifically, data source components corresponding to different data sources can be provided, and each database component contained in each data source can be provided, and each data table component contained in each database can be provided. The user can select the data source to be queried through the data source component, and then select the database to be queried in each database component, and then select the data table to be queried in each data table component, and finally determine the query field and query condition in the data table to be queried.

[0114] After the user selects the information to be queried through any of the above methods, the computer device can generate a query instruction based on the information to be queried, and the computer device can extract the identifiers of the information to be queried and the data table from the query instruction, and then perform data query based on the information to be queried and the data table to be queried.

[0115] The method described in the embodiments of the present application can realize human-computer interaction by setting a query interface.

[0116] In one embodiment, a specific implementation method for obtaining the associated information of the data table where the query information is located is also provided. The "obtaining the associated information of the data table where the information to be queried is located" in the above step S101 includes:

[0117] According to the identifier of the data table, the associated information of the data table where the information to be queried is located is extracted from the preset auxiliary table.

[0118] The preset auxiliary table includes the association information of multiple data tables; the association information includes the data storage scale of the corresponding data table, the index field index_fields of the data table, the binding information enable_query_engine of the data table, and the identifier of the data table. The data storage scale of the data table includes the total data volume rows_count of the data table and the data storage volume storage_capacity of the data table. The total data volume of the data table directly affects the depth of the B+ tree and can reflect the query time to a certain extent. The data storage volume of the data table can estimate the maximum memory space occupied by a query.

[0119] In an embodiment of the present application, a computer device can construct a preset auxiliary table statistic_auxiliary_table in advance based on the relationship between the data source, the database and the data table. Specifically, a preset auxiliary table can be constructed based on each data source, each database under each data source, each data table under each database and the data information in each data table to record the data information in each data table. For example, the information of the data table can be represented by each data row in the preset auxiliary table, and the information of the preset auxiliary table can be updated periodically using the scheduled task middleware QUARTZ.

[0120] The method described in the embodiment of the present application can simplify the query process by constructing a preset auxiliary table and extracting the associated information of the data table from the preset auxiliary table, avoiding the need for users to manually search for the associated information of the data table, improving the query accuracy and efficiency, and facilitating data updating and maintenance.

[0121] Based on all the above embodiments, a query method is also provided, such as Fig. 9 As shown, the method includes:

[0122] S501, in response to a query instruction input by a user in a query interface, extracting associated information of the data table where the information to be queried is located from a preset auxiliary table according to an identifier of the data table.

[0123] S502: Determine the data storage scale of the data table according to the association information of the data table.

[0124] S503, determining whether the data storage scale of the data table meets the preset scale requirement, if so, executing step S504, if not, executing step S505.

[0125] S504: Determine that the query strategy is a statement query mode.

[0126] S505, determining whether the data table has been bound to the query engine according to the association information of the data table, if it has been bound, executing step S506, if it has not been bound, executing step S507.

[0127] S506: Determine the query strategy as the engine query mode.

[0128] S507, determine whether the information to be queried is in the index field, if so, execute step S508, if not, execute step S509.

[0129] S508: Determine that the query strategy is an index query mode.

[0130] S509: Determine that the query strategy is a statement query mode.

[0131] S510, querying the information to be queried in the data table according to the query strategy to obtain the query result.

[0132] S511, determining the query efficiency occupied by querying the information to be queried.

[0133] S512, compare the query efficiency with a preset efficiency threshold, if the query efficiency is less than the preset efficiency threshold, execute step S513, if the query efficiency is not less than the preset efficiency threshold, execute step S514.

[0134] S513, bind the data table to the target query engine, synchronize the data contained in the data table to the target query engine, and update the binding information in the associated information.

[0135] S514: Do not bind the target query engine to the data table.

[0136] The methods described in the above steps are all described in the above embodiments. Please refer to the above description for details and will not be repeated here.

[0137] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0138] Based on the same inventive concept, the embodiment of the present application also provides a query device for implementing the query method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more query device embodiments provided below can refer to the limitations on the query method above, and will not be repeated here.

[0139] In one embodiment, Fig.10 As shown, a query device is provided, comprising:

[0140] The acquisition module 10 is used to acquire the associated information of the data table where the information to be queried is located.

[0141] The first determination module 11 is used to determine a query strategy according to the associated information; the query strategy includes one of a statement query method, an index query method, and an engine query method.

[0142] The query module 12 is used to query the information to be queried in the data table according to the query strategy to obtain the query result.

[0143] In one embodiment, the acquisition module 10 includes:

[0144] The first determining unit is used to determine the data storage scale of the data table according to the associated information of the data table.

[0145] The first determining unit includes:

[0146] The first determining subunit is used to determine the query strategy as a statement query mode if the data storage scale meets the preset scale requirement.

[0147] The second determining subunit is used to determine the query strategy as one of the index query mode, the engine query mode and the statement query mode if the data storage scale does not meet the preset scale requirement.

[0148] In one embodiment, the above-mentioned second determination sub-unit is specifically used to determine whether the data table is bound to the query engine based on the associated information of the data table; if it is determined that the data table is bound to the query engine, the query strategy is determined to be the engine query mode; if it is determined that the data table is not bound to the query engine, the query strategy is determined to be the index query mode or the statement query mode based on the index field in the associated information.

[0149] In one embodiment, the above-mentioned second determination subunit is also specifically used to determine whether the information to be queried is in the index field; if the information to be queried is in the index field, the query strategy is determined to be the index query method; if the information to be queried is not in the index field, the query strategy is determined to be the statement query method.

[0150] In one embodiment, Fig.11 As shown, the query device further includes:

[0151] The second determining module 13 is used to determine the query efficiency occupied by querying the information to be queried.

[0152] The second determining module 13 includes:

[0153] The binding unit is used to bind the data table to the target query engine if the query efficiency is less than a preset efficiency threshold, synchronize the data contained in the data table to the target query engine, and update the binding information in the associated information.

[0154] In one embodiment, Fig.12 As shown, the query device further includes:

[0155] The response module 14 is used to respond to the query instruction input by the user in the query interface and execute the step of obtaining the associated information of the data table where the information to be queried is located; the query instruction includes the identifier of the information to be queried and the data table.

[0156] In one embodiment, the acquisition module 10 is specifically used to extract the associated information of the data table where the information to be queried is located from a preset auxiliary table according to the identifier of the data table; the preset auxiliary table includes the associated information of multiple data tables; the associated information includes the data storage scale of the corresponding data table, the index field of the data table, the binding information of the data table, and the identifier of the data table.

[0157] Each module in the query device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0158] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0159] Obtain the associated information of the data table where the information to be queried is located;

[0160] Determine a query strategy based on the associated information; the query strategy includes one of a statement query method, an index query method, and an engine query method;

[0161] The information to be queried is queried in the data table according to the query strategy to obtain the query result.

[0162] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0163] Determine the data storage scale of the data table based on the associated information of the data table;

[0164] If the data storage scale meets the preset scale requirement, the query strategy is determined to be the statement query mode;

[0165] If the data storage scale does not meet the preset scale requirement, the query strategy is determined to be one of the index query method, the engine query method and the statement query method.

[0166] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0167] According to the association information of the data table, determine whether the data table has been bound to the query engine;

[0168] If it is determined that the data table has been bound to a query engine, the query strategy is determined to be the engine query mode;

[0169] If it is determined that the data table is not bound to a query engine, the query strategy is determined to be an index query method or a statement query method according to the index field in the associated information.

[0170] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0171] Determine whether the information to be queried is in the index field;

[0172] If the information to be queried is in the index field, the query strategy is determined to be the index query mode;

[0173] If the information to be queried is not in the index field, the query strategy is determined to be a statement query mode.

[0174] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0175] Determine the query efficiency occupied by querying the information to be queried;

[0176] If the query efficiency is less than the preset efficiency threshold, the target query engine is bound to the data table, the data contained in the data table is synchronized to the target query engine, and the binding information in the associated information is updated.

[0177] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0178] In response to a query instruction input by a user in a query interface, a step of acquiring associated information of a data table where the information to be queried is located is executed; the query instruction includes the identifiers of the information to be queried and the data table.

[0179] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0180] According to the identifier of the data table, the associated information of the data table where the information to be queried is located is extracted from the preset auxiliary table; the preset auxiliary table includes the associated information of multiple data tables; the associated information includes the data storage scale of the corresponding data table, the index field of the data table, the binding information of the data table, and the identifier of the data table.

[0181] The above embodiment provides a computer device, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.

[0182] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0183] Obtain the associated information of the data table where the information to be queried is located;

[0184] Determine a query strategy based on the associated information; the query strategy includes one of a statement query method, an index query method, and an engine query method;

[0185] The information to be queried is queried in the data table according to the query strategy to obtain the query result.

[0186] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0187] Determine the data storage scale of the data table based on the associated information of the data table;

[0188] If the data storage scale meets the preset scale requirement, the query strategy is determined to be the statement query mode;

[0189] If the data storage scale does not meet the preset scale requirement, the query strategy is determined to be one of the index query method, the engine query method and the statement query method.

[0190] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0191] According to the association information of the data table, determine whether the data table has been bound to the query engine;

[0192] If it is determined that the data table has been bound to a query engine, the query strategy is determined to be the engine query mode;

[0193] If it is determined that the data table is not bound to a query engine, the query strategy is determined to be an index query method or a statement query method according to the index field in the associated information.

[0194] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0195] Determine whether the information to be queried is in the index field;

[0196] If the information to be queried is in the index field, the query strategy is determined to be the index query mode;

[0197] If the information to be queried is not in the index field, the query strategy is determined to be a statement query mode.

[0198] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0199] Determine the query efficiency occupied by querying the information to be queried;

[0200] If the query efficiency is less than the preset efficiency threshold, the target query engine is bound to the data table, the data contained in the data table is synchronized to the target query engine, and the binding information in the associated information is updated.

[0201] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0202] In response to a query instruction input by a user in a query interface, a step of acquiring associated information of a data table where the information to be queried is located is executed; the query instruction includes the identifiers of the information to be queried and the data table.

[0203] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0204] According to the identifier of the data table, the associated information of the data table where the information to be queried is located is extracted from the preset auxiliary table; the preset auxiliary table includes the associated information of multiple data tables; the associated information includes the data storage scale of the corresponding data table, the index field of the data table, the binding information of the data table, and the identifier of the data table.

[0205] The above embodiment provides a computer-readable storage medium, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.

[0206] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0207] Obtain the associated information of the data table where the information to be queried is located;

[0208] Determine a query strategy based on the associated information; the query strategy includes one of a statement query method, an index query method, and an engine query method;

[0209] The information to be queried is queried in the data table according to the query strategy to obtain the query result.

[0210] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0211] Determine the data storage scale of the data table based on the associated information of the data table;

[0212] If the data storage scale meets the preset scale requirement, the query strategy is determined to be the statement query mode;

[0213] If the data storage scale does not meet the preset scale requirement, the query strategy is determined to be one of the index query method, the engine query method and the statement query method.

[0214] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0215] According to the association information of the data table, determine whether the data table has been bound to the query engine;

[0216] If it is determined that the data table has been bound to a query engine, the query strategy is determined to be the engine query mode;

[0217] If it is determined that the data table is not bound to a query engine, the query strategy is determined to be an index query method or a statement query method according to the index field in the associated information.

[0218] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0219] Determine whether the information to be queried is in the index field;

[0220] If the information to be queried is in the index field, the query strategy is determined to be the index query mode;

[0221] If the information to be queried is not in the index field, the query strategy is determined to be a statement query mode.

[0222] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0223] Determine the query efficiency occupied by querying the information to be queried;

[0224] If the query efficiency is less than the preset efficiency threshold, the target query engine is bound to the data table, the data contained in the data table is synchronized to the target query engine, and the binding information in the associated information is updated.

[0225] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0226] In response to a query instruction input by a user in a query interface, a step of acquiring associated information of a data table where the information to be queried is located is executed; the query instruction includes the identifiers of the information to be queried and the data table.

[0227] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0228] According to the identifier of the data table, the associated information of the data table where the information to be queried is located is extracted from the preset auxiliary table; the preset auxiliary table includes the associated information of multiple data tables; the associated information includes the data storage scale of the corresponding data table, the index field of the data table, the binding information of the data table, and the identifier of the data table.

[0229] The above embodiment provides a computer program product, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.

[0230] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0231] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0232] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A query method, characterized in that: The method comprises: Acquire the associated information of the data table where the information to be queried is located; the information to be queried includes the identifier of the data table where the information to be queried is located, the identifier of the database where the data table is located, or the identifier of the data source where the database is located; the associated information of the data table includes the total amount of data in the data table, the data storage amount of the data table, the index field of the data table, the identifier of the data table, and the binding information of the data table; the binding information of the data table is whether to bind to the query engine; Determine a query strategy according to the associated information; the query strategy includes one of a statement query method, an index query method, and an engine query method; If the query strategy is the statement query method, a first query statement is constructed according to the information to be queried, and data query is performed according to the first query statement to obtain the query result; if the query strategy is the index query method, a second query statement is constructed according to the information to be queried and the index information, and data query is performed according to the second query statement to obtain the query result; if the query strategy is the engine query method, a query engine is determined, and data query is performed according to the information to be queried and the query engine to obtain the query result.

2. The method according to claim 1, characterized in that The determining of the query strategy according to the associated information includes: Determining the data storage scale of the data table according to the associated information of the data table; If the data storage scale meets the preset scale requirement, determining that the query strategy is the statement query method; If the data storage scale does not meet the preset scale requirement, the query strategy is determined to be one of the index query method, the engine query method and the statement query method.

3. The method according to claim 2, characterized in that The determining that the query strategy is one of the index query mode, the engine query mode, and the statement query mode includes: Determining whether the data table has been bound to a query engine according to the association information of the data table; If it is determined that the data table has been bound to the query engine, determining that the query strategy is the engine query mode; If it is determined that the data table is not bound to the query engine, the query strategy is determined to be the index query method or the statement query method according to the index field in the association information.

4. The method according to claim 3, characterized in that The determining, according to the index field in the association information, that the query strategy is the index query method or the statement query method includes: Determine whether the information to be queried is in the index field; If the information to be queried is in the index field, determining that the query strategy is the index query method; If the information to be queried is not in the index field, the query strategy is determined to be the statement query method.

5. The method according to any one of claims 1 to 4, characterized in that: The query strategy is the statement query method or the index query method. After querying the information to be queried in the data table according to the query strategy and obtaining the query result, the method further includes: Determining the query efficiency occupied by querying the information to be queried; If the query efficiency is less than a preset efficiency threshold, the data table is bound to a target query engine, the data contained in the data table is synchronized to the target query engine, and the binding information in the association information is updated.

6. The method according to claim 1, characterized in that The method further comprises: In response to a query instruction input by a user in a query interface, the step of obtaining the associated information of the data table where the information to be queried is located is executed; the query instruction includes the identifiers of the information to be queried and the data table.

7. The method according to claim 1 or 6, characterized in that: The step of obtaining the associated information of the data table where the information to be queried is located includes: According to the identifier of the data table, the associated information of the data table where the information to be queried is located is extracted from the preset auxiliary table; the preset auxiliary table includes the associated information of multiple data tables; the associated information includes the data storage scale of the corresponding data table, the index field of the data table, the binding information of the data table, and the identifier of the data table.

8. A query device, characterized in that: The device comprises: An acquisition module is used to acquire the associated information of the data table where the information to be queried is located; the information to be queried includes the identifier of the data table where the information to be queried is located, the identifier of the database where the data table is located, or the identifier of the data source where the database is located; the associated information of the data table includes the total amount of data in the data table, the data storage amount of the data table, the index field of the data table, the identifier of the data table, and the binding information of the data table; the binding information of the data table is whether to bind to the query engine; A first determination module is used to determine a query strategy according to the associated information; the query strategy includes one of a statement query method, an index query method, and an engine query method; A query module, which is used to, if the query strategy is the statement query method, construct a first query statement according to the information to be queried, and perform data query according to the first query statement to obtain the query result; if the query strategy is the index query method, construct a second query statement according to the information to be queried and the index information, and perform data query according to the second query statement to obtain the query result; if the query strategy is the engine query method, determine the query engine, and perform data query according to the information to be queried and the query engine to obtain the query result.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

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

Citation Information

Patent Citations

  • Data query platform, method, and equipment and storage medium

    CN110222072A

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

    CN113836163A