Inter-ad query optimization system and method based on target engine features
By analyzing query requests and combining judgment strategy matching query strategies, the query strategy is updated using the optimization model, and the query delay caused by low query efficiency and insufficient resources in the existing technology, and the lack of automatic adaptation capabilities are solved, and efficient and flexible improvised query optimization is achieved.
Patent Information
- Application Number
- CN202510163430.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-06-06
AI Technical Summary
The prior art takes a long time to query on execution engines such as Hive or Spark, resulting in low query efficiency; it is impossible to respond to high-priority SQL query requests in a timely manner when resources are insufficient in a unified Spark queue, resulting in query delays; and the lack of ability to automatically adapt to different SQL queries to the most suitable query engines, limiting the optimization of query performance and effective utilization of resources.
The data source and engine permission information are obtained by analyzing the query request, combined with the judgment strategy, the appropriate query strategy is accurately matched, and the optimization model is used to update the query strategy in real time to flexibly respond to different situations. If there is no suitable execution engine under the current policy, redetermine the query policy and determine the alternatives for the query to enhance the flexibility of the query.
It significantly improves the response speed and accuracy of improvised queries, optimizes the user experience, and improves query efficiency and flexibility.
Smart Images

Figure CN120104648A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to an ad hoc query optimization system, method, electronic device, readable storage medium and computer program product based on target engine features. Background Art
[0002] With the rapid development of information technology, the amount of data in the production environment has increased dramatically, which has put forward higher requirements for the convenience and security of data query. In order to meet this demand, the existing technology provides an ad hoc query page, which allows users to query the database in real time online. The ad hoc query page provides a certain degree of convenience, but there are still some defects in practical applications, such as:
[0003] 1. On execution engines such as Hive or Spark, query operations often take a long time, affecting query efficiency, especially when processing large-scale data.
[0004] 2. In a unified Spark queue, when resources are insufficient, the system cannot respond to high-priority SQL query requests in a timely manner, resulting in query delays for key businesses.
[0005] 3. The existing system lacks the ability to automatically adapt different SQL queries to the most suitable query engine, which not only increases the difficulty of use, but also limits the optimization of query performance and the effective use of resources.
[0006] Therefore, it is necessary to propose an ad hoc query optimization system, method, electronic device, readable storage medium and computer program product based on target engine characteristics. Summary of the invention
[0007] The present specification provides an ad hoc query optimization system, method, electronic device, readable storage medium and computer program product based on target engine characteristics, which obtains data source and engine authority information by parsing query requests, and accurately matches appropriate query strategies in combination with judgment strategies; uses optimization models to update query strategies in real time to ensure that different situations can be flexibly responded to during execution; if there is no suitable execution engine under the current strategy, the query strategy is re-determined, alternative query plans are determined, and query flexibility is enhanced; through intelligent and automated strategy matching and engine selection, the response speed and accuracy of ad hoc queries are significantly improved, and the user experience is optimized.
[0008] The present application provides an ad hoc query optimization method based on target engine characteristics, which adopts the following technical solutions, including:
[0009] Get the user's query request;
[0010] Matching the query request with the corresponding target engine features and the current query strategy in combination with the judgment strategy;
[0011] The current query strategy is updated by optimizing the model; wherein the current query strategy is executed to obtain the execution result of the query strategy; when the target execution engine does not exist in the current query strategy, the target engine characteristics are updated according to the judgment strategy, and a new current query strategy is re-determined based on the updated target engine characteristics;
[0012] The query result of the target execution engine is pushed to the user.
[0013] Optionally, the matching the query request with the corresponding target engine feature and the current query strategy in combination with the judgment strategy includes:
[0014] Parsing the query request to obtain a parsing result;
[0015] Based on the judgment strategy, determining the target engine feature corresponding to the parsing result;
[0016] A query strategy corresponding to the target engine feature is searched and used as the current query strategy.
[0017] Optionally, the parsing result includes: data source information and engine authority information;
[0018] The query request is parsed to obtain a parsing result, including:
[0019] Identifying original library table information and identity information of the user from the query request;
[0020] Find the target data source corresponding to the original library table information;
[0021] The library table authorization information is retrieved according to the identity information; all the authorized engine information is extracted from the library table authorization information to construct the engine permission information.
[0022] Optionally, the judgment strategy includes a plurality of ordered engine features;
[0023] The determining, based on the judgment strategy, the target engine feature corresponding to the parsing result includes:
[0024] Using the first engine feature as the current engine feature;
[0025] Determining whether the parsing result includes the current engine feature;
[0026] If the parsing result includes the current engine feature, taking the current engine feature as the target engine feature;
[0027] If the parsing result does not include the current engine feature, the next engine feature is used as a new current engine feature.
[0028] Optionally, executing the current query strategy includes:
[0029] When the current query strategy is the first query strategy, the first preset engine is executed and the first preset engine is used as the target execution engine.
[0030] Optionally, executing the current query strategy includes:
[0031] When the current query strategy is the second query strategy, determining whether the parsing result meets preset requirements; the preset requirements include: the query statement includes preset sub-statements, and / or the target data source is a preset data source type;
[0032] If yes, execute the second preset engine and use the second preset engine as the target execution engine;
[0033] If not, execute the third preset engine; and determine the target execution engine based on the execution status of the third preset engine.
[0034] Optionally, determining the target execution engine based on the execution status of the third preset engine includes:
[0035] If the execution result of the third preset engine is successful, taking the third preset engine as the target execution engine;
[0036] If the execution result of the third preset engine is failure, determining whether the data source information is in the presto blacklist;
[0037] If the data source information is in the presto blacklist, executing the fifth preset engine;
[0038] If the data source information is not in the presto blacklist, the fourth preset engine is executed; if the execution result of the fourth preset engine is successful, the fourth preset engine is used as the target execution engine; if the execution result of the fourth preset engine is failed, the fifth preset engine is executed;
[0039] If the execution result of the fifth preset engine is failure, it is determined that there is no target execution engine in the current query strategy.
[0040] Optionally, executing the fifth preset engine includes:
[0041] Acquire cluster resource information related to the query request;
[0042] Determine whether the cluster resource information contains the first field information; if the cluster resource information contains the first field information, use the BJMD cluster to perform the query;
[0043] If the cluster resource information does not include the first field information, determining whether the cluster resource information contains the first queue information; if the cluster resource information contains the first queue information, performing a query based on the first queue information;
[0044] If the first queue information does not exist in the cluster resource information, determining whether the second queue information exists in the cluster resource information; if the second queue information exists in the cluster resource information, performing a query based on the second queue information;
[0045] If the second queue information does not exist in the cluster resource information, determining whether the third queue information exists in the cluster resource information; if the third queue information exists in the cluster resource information, performing a query based on the third queue information;
[0046] If the third queue information does not exist in the cluster resource information, query is performed based on default queue information.
[0047] Optionally, executing the current query strategy includes:
[0048] When the current query strategy is the third query strategy, the sixth preset engine is used as the current execution engine;
[0049] When the current query strategy is the fourth query strategy, the third preset engine is used as the current execution engine;
[0050] If the execution result of the current execution engine is successful, the current execution engine is used as the target execution engine; if the execution result of the current execution engine is failed, it is determined that there is no target execution engine in the current query strategy.
[0051] Optionally, when the target execution engine does not exist in the current query strategy, updating the target engine feature according to the judgment strategy, and re-determining a new current query strategy based on the updated target engine feature, includes:
[0052] When the target execution engine does not exist in the current query strategy, searching for the next engine feature and using it as a new current engine feature;
[0053] Determining whether the parsing result includes the current engine feature;
[0054] If the analysis result includes the current engine feature, the current engine feature is used as the target engine feature;
[0055] Based on the target engine characteristics, a new current query strategy is matched.
[0056] The present application provides an ad hoc query optimization system based on target engine features, which adopts the following technical solutions, including:
[0057] The acquisition module is used to obtain the user's query request;
[0058] A matching module, used to match the corresponding target engine features and the current query strategy for the query request in combination with the judgment strategy;
[0059] An optimization module, used for updating the current query strategy through an optimization model;
[0060] The push module is used to push the query result of the target execution engine to the user.
[0061] Optionally, the optimization module includes:
[0062] An execution submodule, used to execute the current query strategy and obtain the execution result of the query strategy;
[0063] An updating submodule, used for updating the target engine characteristics according to the judgment strategy when there is no target execution engine in the current query strategy, and re-determining a new current query strategy based on the updated target engine characteristics;
[0064] Optionally, the matching module includes:
[0065] A parsing submodule, used to parse the query request and obtain a parsing result;
[0066] A feature determination submodule, used to determine the target engine feature corresponding to the parsing result based on the judgment strategy;
[0067] The search submodule is used to search for a query strategy corresponding to the target engine feature as the current query strategy.
[0068] Optionally, the parsing result includes: data source information and engine authority information;
[0069] Optionally, the parsing submodule includes:
[0070] An identification unit, used to identify original library table information and identity information of the user from the query request;
[0071] A search unit, used to search for a target data source corresponding to the original library table information;
[0072] The construction unit is used to retrieve the library table authorization information according to the identity information; extract all authorized engine information from the library table authorization information, and construct the engine permission information.
[0073] Optionally, the judgment strategy includes a plurality of ordered engine features;
[0074] Optionally, the feature determination submodule includes:
[0075] A first analysis unit, configured to use the first engine feature as a current engine feature;
[0076] A second analysis unit, used to determine whether the analysis result includes the current engine feature;
[0077] a third analyzing unit, configured to use the current engine feature as the target engine feature if the parsing result includes the current engine feature;
[0078] The loop unit is used to use the next engine feature as a new current engine feature if the parsing result does not include the current engine feature.
[0079] Optionally, the execution submodule includes:
[0080] The first execution unit is configured to execute a first preset engine when the current query strategy is the first query strategy, and use the first preset engine as the target execution engine.
[0081] Optionally, the execution submodule includes:
[0082] A second execution unit, configured to determine a target execution engine according to an execution status of the second query strategy when the current query strategy is the second query strategy;
[0083] Optionally, the second execution unit includes:
[0084] A preset requirement judgment subunit is used to judge whether the parsing result meets the preset requirements; the preset requirements include: the query statement includes a preset sub-statement, and / or the target data source is a preset data source type;
[0085] A first result subunit is configured to execute a second preset engine if the parsing result meets a preset requirement, and use the second preset engine as the target execution engine;
[0086] A second result subunit, configured to execute a third preset engine if the parsing result does not meet the preset requirement;
[0087] The execution update subunit is used to determine the target execution engine based on the execution status of the third preset engine.
[0088] Optionally, the execution update subunit includes:
[0089] If the execution result of the third preset engine is successful, taking the third preset engine as the target execution engine;
[0090] If the execution result of the third preset engine is failure, determining whether the data source information is in the presto blacklist;
[0091] If the data source information is in the presto blacklist, executing the fifth preset engine;
[0092] If the data source information is not in the presto blacklist, the fourth preset engine is executed; if the execution result of the fourth preset engine is successful, the fourth preset engine is used as the target execution engine; if the execution result of the fourth preset engine is failed, the fifth preset engine is executed;
[0093] If the execution result of the fifth preset engine is failure, it is determined that there is no target execution engine in the current query strategy.
[0094] Optionally, executing the fifth preset engine includes:
[0095] Acquire cluster resource information related to the query request;
[0096] Determine whether the cluster resource information contains the first field information; if the cluster resource information contains the first field information, use the BJMD cluster to perform the query;
[0097] If the cluster resource information does not include the first field information, determining whether the cluster resource information contains the first queue information; if the cluster resource information contains the first queue information, performing a query based on the first queue information;
[0098] If the first queue information does not exist in the cluster resource information, determining whether the second queue information exists in the cluster resource information; if the second queue information exists in the cluster resource information, performing a query based on the second queue information;
[0099] If the second queue information does not exist in the cluster resource information, determining whether the third queue information exists in the cluster resource information; if the third queue information exists in the cluster resource information, performing a query based on the third queue information;
[0100] If the third queue information does not exist in the cluster resource information, query is performed based on default queue information.
[0101] Optionally, the execution submodule includes:
[0102] a third execution unit, configured to use the sixth preset engine as the current execution engine when the current query strategy is the third query strategy;
[0103] a fourth execution unit, configured to use the third preset engine as the current execution engine when the current query strategy is the fourth query strategy;
[0104] If the execution result of the current execution engine is successful, the current execution engine is used as the target execution engine; if the execution result of the current execution engine is failed, it is determined that there is no target execution engine in the current query strategy.
[0105] Optionally, the updating submodule includes:
[0106] An updating unit, configured to, when the target execution engine does not exist in the current query strategy, call the loop unit to find the next engine feature and use it as a new current engine feature;
[0107] Invoking a second analysis unit to determine whether the parsing result includes the current engine feature;
[0108] If the analysis result includes the current engine feature, calling the third analysis unit to use the current engine feature as the target engine feature;
[0109] The search submodule is called to match the new current query strategy based on the target engine characteristics.
[0110] This specification also provides a computer device, wherein the computer device includes:
[0111] processor; and,
[0112] A memory storing computer executable instructions, which when executed cause the processor to perform any of the above methods.
[0113] This specification also provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs / instructions, and when the one or more programs / instructions are executed by a processor, any of the above methods is implemented.
[0114] This specification also provides a computer program product, wherein the computer program product includes: a computer program / instructions, and when the computer program / instructions are executed by a processor, any of the above methods is implemented.
[0115] In the present invention, a query request of a user is obtained; the query request is matched with the corresponding target engine characteristics and the current query strategy in combination with the judgment strategy; the current query strategy is updated through an optimization model; wherein, the current query strategy is executed to obtain an execution result of the query strategy; when the target execution engine does not exist in the current query strategy, the target engine characteristics are updated according to the judgment strategy, and a new current query strategy is re-determined based on the updated target engine characteristics; the query result of the target execution engine is pushed to the user; the query request is accurately matched with the target engine characteristics and the current query strategy according to the judgment strategy, thereby ensuring the pertinence of the query; the current query strategy is dynamically adjusted using the optimization model to make it more in line with actual needs, thereby effectively improving the query efficiency and the flexibility of the query. BRIEF DESCRIPTION OF THE DRAWINGS
[0116] Figure 1 A schematic diagram of the principle of an ad hoc query optimization method based on target engine characteristics provided in an embodiment of this specification;
[0117] Figure 2 A structural diagram of an ad hoc query optimization method based on target engine characteristics provided in an embodiment of this specification;
[0118] Figure 3 A flowchart of an ad hoc query optimization method based on target engine features provided in an embodiment of this specification Figure 1 ;
[0119] Figure 4 A flowchart of an ad hoc query optimization method based on target engine features provided in an embodiment of this specification Figure 2 ;
[0120] Figure 5 A flowchart of step S312 of an ad hoc query optimization method based on target engine features provided in an embodiment of this specification;
[0121] Figure 6 A flowchart of step S312-3-4 of an ad hoc query optimization method based on target engine features provided in an embodiment of this specification;
[0122] Figure 7 A flowchart of the overall execution logic of an ad hoc query optimization method based on target engine characteristics provided in an embodiment of this specification;
[0123] Figure 8 A schematic diagram of the structure of an ad hoc query optimization system based on target engine features provided in an embodiment of this specification;
[0124] Fig. 9A schematic diagram of the structure of an electronic device provided in an embodiment of this specification;
[0125] Fig.10 A schematic diagram of a computer-readable storage medium provided in accordance with an embodiment of the present specification. DETAILED DESCRIPTION
[0126] The following description is used to disclose the present invention so that those skilled in the art can implement the present invention. The preferred embodiments described below are only examples, and those skilled in the art can think of other obvious variations. The basic principles of the present invention defined in the following description can be applied to other embodiments, variations, improvements, equivalents, and other technical solutions that do not deviate from the spirit and scope of the present invention.
[0127] The exemplary embodiments of the present invention will now be described more fully with reference to the accompanying drawings. Under the premise of being consistent with the technical concept of the present invention, the features, structures, characteristics or other details described in a particular embodiment do not exclude that they can be combined in one or more other embodiments in a suitable manner.
[0128] The term "and / or" or "and / or" includes all combinations of any one or more of the associated listed items.
[0129] Figure 1 A schematic diagram of the principle of an ad hoc query optimization method based on target engine characteristics provided in an embodiment of this specification includes:
[0130] S1 obtains the user's query request;
[0131] S2 matches the query request with the corresponding target engine feature and the current query strategy in combination with the judgment strategy;
[0132] S3 updates the current query strategy by optimizing the model; wherein the current query strategy is executed to obtain the execution result of the query strategy; when the target execution engine does not exist in the current query strategy, the target engine characteristics are updated according to the judgment strategy, and a new current query strategy is re-determined based on the updated target engine characteristics;
[0133] S4 pushes the query result of the target execution engine to the user.
[0134] Data query mainly includes: general query and ad hoc query. General query is known when the system is designed and implemented, and its query function is custom developed. Therefore, these queries can be optimized and query efficiency can be improved by establishing indexes, partitions and other technologies when the system is implemented.
[0135] Ad Hoc Query is a query method that allows users to flexibly select query conditions based on their needs to query the database. This query method uses JDBC technology to interface with multiple databases, allowing users to access different types of database data, with high flexibility and convenience.
[0136] However, in practical applications, ad hoc queries still have some defects, which are mainly manifested in the following aspects:
[0137] 1. Query performance issues: Ad hoc queries are usually dynamic and may not be optimized using indexing, partitioning, and other technologies like predefined queries. Therefore, on executors such as Hive or Spark, query operations often take a long time due to the need to dynamically parse and execute queries, affecting query efficiency, especially when processing large-scale data.
[0138] 2. Resource allocation problem: Ad hoc queries are usually executed in a unified Spark queue. When resources are insufficient, the system may not be able to respond to high-priority SQL query requests in a timely manner, resulting in query delays for critical businesses.
[0139] 3. Data source routing problem: The existing system lacks the ability to automatically adapt different SQL queries to the most suitable query engine, which not only increases the difficulty of use, but also limits the optimization of query performance and the effective use of resources.
[0140] Therefore, in order to further improve the query efficiency of ad hoc queries, the present invention provides an ad hoc query optimization method based on target engine characteristics, such as Figure 2 As shown, specifically including:
[0141] S1 obtains the user's query request;
[0142] The user executes an SQL query; specifically, the user sends a query request to the server through an ad hoc query page (or other query interface); the server obtains the query request, performs SQL splitting and data source cluster identification, and creates a task. The query request includes a query statement, and the query statement is preferably an SQL query statement.
[0143] S2 matches the query request with the corresponding target engine feature and the current query strategy in combination with the judgment strategy;
[0144] After the task creation is completed, based on the MQ message center task distribution, the parsing results are sent to the pre-processor chain before execution for processing. Based on the pre-processor chain before execution, SQL parsing and SQL permission verification are performed on the query request. Specifically:
[0145] S21 parses the query request to obtain a parsing result;
[0146] The analysis result includes: data source information and engine permission information.
[0147] S211 identifies original library table information and identity information of the user from the query request;
[0148] The parsing function is called to parse the query statement input by the user in the query request, and the original library table information and the user's identity information corresponding to the query statement are identified.
[0149] In one embodiment of the present specification, the original database table information includes: a database name corresponding to the query statement and / or a data table name corresponding to the query statement.
[0150] S212 searches for a target data source corresponding to the original library table information;
[0151] The configuration management database (CMDB) stores the association information between library table information and data sources. Specifically, the configuration management database (CMDB) records which data source on the data source server side each library table information belongs to. Data source servers include: mySQL, tidb, doris, clickhouse, hdfs, etc.
[0152] By configuring the management database, the target data source corresponding to the original library table information is queried to facilitate dynamic management of the data source and ensure the accuracy and consistency of data access.
[0153] S213 retrieves the library table authorization information according to the identity information; extracts all authorized engine information from the library table authorization information, and constructs the engine permission information.
[0154] In a distributed database or cloud database system, the database is usually stored in multiple computer rooms (or data centers). Each computer room may contain multiple database engines (or instances), which are responsible for storing and managing data and providing data access interfaces.
[0155] Obtain identity information and query the library and table authorization information corresponding to the identity information through Data Access Management (DAM);
[0156] The library table authorization information includes: the database engines that the user is authorized to use, and the tuples of the computer rooms where each database engine is located.
[0157] All authorized engine information is extracted from the library table authorization information to construct the engine permission information.
[0158] Retrieving the library table authorization information based on the identity information and building the engine permission information can ensure that users can only access the engines and data sources for which they are authorized.
[0159] S22, based on the judgment strategy, determining the target engine feature corresponding to the parsing result;
[0160] The judgment strategy includes a number of ordered engine features;
[0161] Specifically, Figure 3 As shown:
[0162] S221 uses the first engine feature as the current engine feature;
[0163] S222 determines whether the analysis result includes the current engine feature;
[0164] S223: if the analysis result includes the current engine feature, taking the current engine feature as the target engine feature;
[0165] S224: If the parsing result does not include the current engine feature, determine whether the current engine feature is the last engine feature; if not, execute S225; otherwise, execute S226.
[0166] S225 takes the next engine feature as the new current engine feature and executes S222 in a loop.
[0167] S226 outputs abnormal query results.
[0168] S23 searches for a query strategy corresponding to the target engine feature as the current query strategy.
[0169] Each engine feature corresponds to a query strategy.
[0170] In one embodiment of the present specification, the first engine feature corresponds to the first query strategy; the second engine feature corresponds to the second query strategy; the third engine feature corresponds to the third query strategy; and the fourth engine feature corresponds to the fourth query strategy.
[0171] In one embodiment of this specification, Figure 4 As shown, the judgment strategy includes four engine features, and the priorities of the four engine features are: first engine feature>second engine feature>third engine feature>fourth engine feature.
[0172] The first engine feature is used as the current engine feature; the first engine feature includes: mysql.
[0173] Determining whether the engine permission information in the parsing result includes a first engine feature;
[0174] If the engine authority information includes the first engine feature, the first engine feature is used as the target engine feature, the corresponding first query strategy is matched, and the first query strategy is executed.
[0175] If the engine permission information does not include the first engine feature, the next engine feature of the first engine feature is used as the current engine feature, that is, the second engine feature is used as the current engine feature; the second engine feature includes: Hive.
[0176] Determining whether the engine permission information in the parsing result includes a second engine feature;
[0177] If the engine authority information includes the second engine feature, the second engine feature is used as the target engine feature, the corresponding second query strategy is matched, and the second query strategy is executed.
[0178] If the engine authority information does not include the second engine feature, the next engine feature of the second engine feature is used as the current engine feature, that is, the third engine feature is used as the current engine feature; the third engine feature includes: Clickhouse.
[0179] Determining whether the engine permission information in the parsing result includes a third engine feature;
[0180] If the engine authority information includes the third engine feature, the third engine feature is used as the target engine feature, the corresponding third query strategy is matched, and the third query strategy is executed.
[0181] If the engine authority information does not include the third engine feature, the next engine feature of the third engine feature is used as the current engine feature, that is, the fourth engine feature is used as the current engine feature; the fourth engine feature includes: doris.
[0182] Determining whether the engine permission information in the parsing result includes a fourth engine feature;
[0183] If the engine authority information includes the fourth engine feature, the fourth engine feature is used as the target engine feature, the corresponding fourth query strategy is matched, and the fourth query strategy is executed.
[0184] If the engine authority information does not include the fourth engine feature, the output query result is an abnormal query result.
[0185] Through the above steps, the present invention will execute the SQL query submitted by the user according to the corresponding target data source. During the execution process, based on the pre-processor chain before execution, the query request is rewritten in SQL to optimize the query statement to ensure query efficiency and accuracy; after the query is completed, the system returns the query result to the user.
[0186] S3 updates the current query strategy by optimizing the model;
[0187] The present invention uses jdbc technology to perform various operations on the database. After the analysis is completed, the most suitable query execution engine is automatically selected for the user based on the analysis results. The user does not need to manually specify the data source, and automatic routing can be performed according to SQL, thereby improving the flexibility and user-friendliness of the query operation. Specifically:
[0188] S31 executes the current query strategy to obtain the execution result of the query strategy;
[0189] S311: when the current query strategy is the first query strategy, executing the first preset engine;
[0190] When the current query strategy is the first query strategy, the first preset engine is executed, and the first preset engine is used as the target execution engine; and it is determined that the first query strategy is executed successfully.
[0191] Among them, the first preset engine is preferably a mysql executor.
[0192] At this time, when the current query strategy is the first query strategy, the mysql executor is used as the target execution engine; the mysql executor is executed to process the query request to obtain the query result.
[0193] S312: when the current query strategy is the second query strategy, determining a target execution engine according to the execution status of the second query strategy;
[0194] like Figure 5 As shown, specifically:
[0195] S312-1 determines whether the analysis result meets the preset requirements;
[0196] The preset requirement includes several preset conditions; as long as the analysis result meets one of the preset conditions, the analysis result is deemed to meet the preset requirement.
[0197] Specifically, the preset requirement includes a first preset condition and a second preset condition.
[0198] The first preset condition includes: the query statement includes a preset sub-statement. The preset sub-statement is a LIMIT clause. The LIMIT clause is usually used to limit the number of returned results.
[0199] The second preset condition includes: the target data source is a preset data source type. The preset data source type is a large data table.
[0200] The determination of whether the analysis result meets the first preset condition and the determination of whether the analysis result meets the second preset condition may be processed in parallel or may be processed sequentially according to a preset order.
[0201] The preset sequence includes: first determining whether the analysis result meets the first preset condition; and then determining whether the analysis result meets the second preset condition.
[0202] Specifically, first determine whether the parsing result contains a LIMIT clause; if so, determine that the parsing result meets the preset requirements, and execute S312-2;
[0203] The target data source is the preset data source type. The preset data source type is a large data table.
[0204] The present invention intelligently selects the appropriate query engine according to different data volumes to improve the efficiency of big data query
[0205] If the LIMIT clause does not exist in the parsing result, determine the target data source; if the parsing result is a large data table; if so, determine that the parsing result meets the preset requirements and execute S312-2; if not, determine that the parsing result does not meet the preset requirements and execute S312-3.
[0206] S312-2 If the analysis result meets the preset requirements, execute the second preset engine;
[0207] If the parsing result meets the preset requirements, the second preset engine is executed; the second preset engine is used as the target execution engine; the second query strategy is deemed to be executed successfully, and a normal query result is output;
[0208] Among them, the second preset engine is preferably a hive executor.
[0209] The Hive executor is more efficient in processing such queries. Therefore, if the SQL statement contains a LIMIT clause, the system will directly use the Hive executor to query.
[0210] Large table operations have high requirements for resources and performance, and the Hive executor can better handle such queries. If the SQL statement involves large table operations, the system will also select the Hive executor for querying.
[0211] At this time, the hive executor is used as the target execution engine; the Hive executor is executed to process the query request to obtain the query result.
[0212] Of course, in one embodiment of the present invention, the doris database resources can also be expanded, and all big data can be imported into the doris database for query.
[0213] S312-3 If the parsing result does not meet the preset requirement, execute the third preset engine; based on the execution status of the third preset engine, determine the target execution engine.
[0214] S312-3-1 executes the third preset engine;
[0215] The third preset engine is preferably the doris executor, which is an execution mechanism (doris on hive) formed by integrating Doris's data or query capabilities into Hive in a Hive environment in some way (such as ETL tools or data migration technology).
[0216] Doris on hive optimizes the query performance of the hive executor and is suitable for processing regular queries.
[0217] Therefore, for SQL queries that do not contain a LIMIT clause and do not involve large tables, the system will first try to use Dorison hive for the query, and then obtain the execution status of the third preset engine;
[0218] If the execution result of the third preset engine is successful, the third preset engine is used as the target execution engine; and the execution of the second query strategy is deemed to be successful;
[0219] If the execution result of the third preset engine is failure, execute S312-3-2;
[0220] S312-3-2 determines whether the data source information is in the presto blacklist;
[0221] If the data source information is not in the presto blacklist, execute S312-3-3;
[0222] If the data source information is in the presto blacklist, execute S312-3-4;
[0223] S312-3-3 execute the fourth preset engine; obtain the execution status of the fourth preset engine;
[0224] If the execution result of the fourth preset engine is successful, the fourth preset engine is used as the target execution engine; and the execution of the second query strategy is deemed to be successful;
[0225] If the execution result of the fourth preset engine is failure, execute S312-3-4;
[0226] The fourth preset engine is preferably the Presto executor, which is known for its fast response and high concurrent processing capabilities and is suitable for processing complex query tasks.
[0227] S312-3-4 executes the fifth preset engine;
[0228] If the execution result of the fifth preset engine is successful, the fifth preset engine is used as the target execution engine; and the second query strategy is deemed to be executed successfully;
[0229] If the execution result of the fifth preset engine is failure, it is determined that there is no target execution engine in the current query strategy; and it is determined that the second query strategy is not executed successfully.
[0230] The fifth preset engine is preferably the Spark executor, which can process complex queries of large-scale data sets with its powerful data processing capabilities and flexibility.
[0231] In order to solve the problem of insufficient resources in the unified Spark queue, the present invention will implement a dynamic resource scheduling strategy to allocate different Spark resource queues according to the importance of different businesses and process high-priority SQL queries in a timely manner.
[0232] When a user submits an SQL query, the system first automatically obtains the corresponding Spark queue resources based on the user's identity and business type. This step is key to ensuring that queries can be executed efficiently because it involves dynamic allocation and scheduling of resources. Once the Spark queue resources corresponding to the user are determined, the system submits the user's SQL query to the queue for execution. The allocation and scheduling mechanism of Spark queue resources ensures that queries can run in the optimal resource environment, thereby improving query execution efficiency and response speed.
[0233] Specifically, Figure 6 As shown, the execution of the fifth preset engine includes:
[0234] (4-1) Obtaining cluster resource information related to the query request in the SQL Server cluster environment;
[0235] (4-2) determining whether the cluster resource information includes first field information; the first field information includes: safelycc;
[0236] If the cluster resource information does not include the first field information (safelycc), execute (4-3);
[0237] If the cluster resource information contains the first field information, use the BJMD cluster to execute the query; and determine whether the execution is successful;
[0238] If the execution result using the BJMD cluster is successful, the execution result of the fifth preset engine is deemed to be successful; if the execution result using the BJMD cluster is unsuccessful, the execution result of the fifth preset engine is deemed to be unsuccessful;
[0239] (4-3) Determine whether there is first queue information in the cluster resource information; the first queue information includes: the cluster queue information specified by the current user:
[0240] If the first queue information does not exist in the cluster resource information, execute (4-4);
[0241] If the first queue information exists in the cluster resource information, executing a query based on the first queue information; and determining whether the query is successful;
[0242] If the execution result using the first queue information is successful, the execution result of the fifth preset engine is deemed to be successful; if the execution result using the first queue information is unsuccessful, the execution result of the fifth preset engine is deemed to be unsuccessful;
[0243] (4-4) determining whether there is second queue information in the cluster resource information; the second queue information includes: cluster queue information specified by a SQL library table;
[0244] If the second queue information does not exist in the cluster resource information, execute (4-5);
[0245] If the second queue information exists in the cluster resource information, executing a query based on the second queue information; and determining whether the query is successful;
[0246] If the execution result using the second queue information is successful, the execution result of the fifth preset engine is deemed to be successful; if the execution result using the second queue information is unsuccessful, the execution result of the fifth preset engine is deemed to be unsuccessful;
[0247] (4-5) determining whether there is third queue information in the cluster resource information; the third queue information includes: a user-specified cluster;
[0248] If the third queue information exists in the cluster resource information, executing a query based on the third queue information; and determining whether the query is successful;
[0249] If the execution result using the third queue information is successful, the execution result of the fifth preset engine is deemed to be successful; if the execution result using the third queue information is unsuccessful, the execution result of the fifth preset engine is deemed to be unsuccessful;
[0250] If the third queue information does not exist in the cluster resource information, querying based on the default queue information; and determining whether the query is successful;
[0251] If the execution result of using the default queue information is successful, the execution result of the fifth preset engine is deemed to be successful; if the execution result of using the default queue information is unsuccessful, the execution result of the fifth preset engine is deemed to be unsuccessful. The default queue information is the safelycc cluster.
[0252] Exclusive Spark queue resources are configured for different business users. This configuration ensures the reasonable allocation and isolation of resources, thereby meeting the specific needs and priorities of different user groups.
[0253] S313: when the current query strategy is the third query strategy, executing the sixth preset engine;
[0254] When the current query strategy is the third query strategy, the sixth preset engine is used as the current execution engine;
[0255] If the execution result of the current execution engine is successful, the current execution engine is used as the target execution engine; and the execution of the third query strategy is determined to be successful;
[0256] If the execution result of the current execution engine is failure, it is determined that there is no target execution engine in the current query strategy; and it is determined that the third query strategy is not executed successfully.
[0257] Among them, the sixth preset engine is preferably a Clickhouse executor.
[0258] S314: when the current query strategy is the fourth query strategy, executing the seventh preset engine;
[0259] When the current query strategy is the fourth query strategy, the seventh preset engine is used as the current execution engine;
[0260] If the execution result of the current execution engine is successful, the current execution engine is used as the target execution engine; and the fourth query strategy is deemed to be executed successfully;
[0261] If the execution result of the current execution engine is failure, it is determined that there is no target execution engine in the current query strategy; and it is determined that the fourth query strategy has not been executed successfully.
[0262] The seventh preset engine is preferably a doris actuator, that is, the seventh preset engine is the same as the third preset engine.
[0263] The present invention provides query engines for various types of databases, performs intelligent analysis and optimization on SQL queries, and automatically matches suitable query engines to reduce query time consumption on executors such as Hive or Spark, thereby improving overall query performance.
[0264] S32: when there is no target execution engine in the current query strategy, updating the target engine characteristics according to the judgment strategy, and re-determining a new current query strategy based on the updated target engine characteristics;
[0265] Determine whether there is a target execution engine in the current query strategy;
[0266] S321: when the target execution engine does not exist in the current query strategy, searching for the next engine feature and using it as a new current engine feature;
[0267] S322 determines whether the analysis result includes the current engine feature;
[0268] S323: if the analysis result includes the current engine feature, taking the current engine feature as the target engine feature;
[0269] S324 matches a new current query strategy based on the target engine feature;
[0270] S325: if the analysis result includes the current engine feature, the current engine feature is used as the target engine feature;
[0271] In one embodiment of the present specification, when the second query strategy is not executed successfully, it is determined that the target execution engine does not exist in the current query strategy, and it is determined whether the parsing result includes the third engine feature. If the parsing result includes the third engine feature, the third query strategy is used as the new current query strategy to execute S313;
[0272] When the third query strategy is not successfully executed, it is determined that the target execution engine does not exist in the current query strategy, and it is determined whether the parsing result includes the fourth engine feature. If the parsing result includes the fourth engine feature, the fourth query strategy is used as a new current query strategy to execute S314;
[0273] When the fourth query strategy is not executed successfully, there is no target execution engine in the current query strategy, and an abnormal query result is output. The abnormal query result may be: there is no executable engine.
[0274] Based on the above steps, the traversal order of engine permission information is: mysql>doris>presto>spark>clickhouse.
[0275] Through the above steps, the specific SQL executor is determined based on the query strategy, and the intelligent execution engine is used to intelligently identify the data source to which the SQL belongs and intelligently forward SQL. The SQL executor includes several preset engines, such as mysql executor, tidb executor, doris executor, clickhouse executor, hive executor, spark executor, and presto executor.
[0276] When Spark is executed, the present invention can allocate query resources according to the importance of the business, effectively improving the efficiency of important business queries;
[0277] In an embodiment of the present invention, query acceleration can also be performed by converting Hive SQL into Trino SQL to query the Trino engine.
[0278] S4 pushes the query result of the target execution engine to the user.
[0279] When the preset engine fails to execute, abnormal query results are output.
[0280] When the preset engine is executed successfully, the query result of the target execution engine is pushed to the user, and a normal query result is output, which refers to the query result of the target execution engine.
[0281] In one embodiment of the present specification, the query result is the SQL execution result. After the execution is completed, the SQL execution result is sent to the post-execution post-processor chain for statistical data reporting, sensitive data detection, and result storage. The pre-execution pre-processor chain sends the SQL execution result to the MQ message center; SQL execution log acquisition and status detection, when the SQL execution result is obtained, the SQL execution result is sent to the user. In order to improve the user experience, the storage and query of the execution results, as well as the storage and query of the execution log are also supported.
[0282] Through the optimization method of the present invention, the SQL query execution efficiency and operational convenience in a big data environment are significantly improved, so that users can improve the usability when using the system for data query and management; when executing complex data queries, they can experience faster response time and shorter waiting cycles.
[0283] Combination Figure 7 , the following briefly describes the overall execution logic:
[0284] ① Determine whether the parsing result includes mysql; if so, select mysql to execute the query request and output normal query results; otherwise, execute ②;
[0285] ② Determine whether the parsing result includes hive; if so, execute ③; otherwise, execute ;
[0286] ③ Determine whether the query request includes a Limit clause; if so, execute ⑥; otherwise, execute ⑤;
[0287] ⑤ Determine whether the target data source is a large data table; if so, execute ⑥; otherwise, execute ⑦;
[0288] ⑥Select Hive to execute the query request and output normal query results;
[0289] ⑦ Select Doris on hive to execute the query request; determine whether Doris on hive is executed successfully; if so, output the normal query results; otherwise, execute ⑧;
[0290] ⑧ Determine whether the query request is in the Presto blacklist; if so, execute ⑩; otherwise, execute ⑨;
[0291] ⑨Select Presto to execute the query request; determine whether Presto is executed successfully; if so, output the normal query results; otherwise, execute ⑩;
[0292] ⑩Select Spark to execute the query request; determine whether Spark is executed successfully; if so, output the normal query results; otherwise, execute ;
[0293] Determine whether the parsing result includes ck(clickhouse); if so, execute Otherwise, execute ;
[0294] Select ck to execute the query request and determine whether ck is executed successfully; if so, output the normal query result; otherwise, execute ;
[0295] Determine whether the parsing result includes Doris; if so, execute ; Otherwise, output abnormal query results;
[0296] Select Doris to execute the query request and determine whether Doris is executed successfully; if so, output normal query results; otherwise, output abnormal query results.
[0297] Figure 8 A structural diagram of an ad hoc query optimization system based on target engine features provided in an embodiment of this specification includes:
[0298] The acquisition module 810 is used to acquire the query request of the user;
[0299] A matching module 820, configured to match the query request with the corresponding target engine features and the current query strategy in combination with the judgment strategy;
[0300] An optimization module 830, configured to update the current query strategy by optimizing the model;
[0301] The push module 840 is used to push the query result of the target execution engine to the user.
[0302] Optionally, the optimization module 830 includes:
[0303] An execution submodule 831 is used to execute the current query strategy and obtain the execution result of the query strategy;
[0304] An updating submodule 832, configured to update the target engine characteristics according to the judgment strategy when there is no target execution engine in the current query strategy, and to re-determine a new current query strategy based on the updated target engine characteristics;
[0305] Optionally, the matching module 820 includes:
[0306] A parsing submodule, used to parse the query request and obtain a parsing result;
[0307] A feature determination submodule, used to determine the target engine feature corresponding to the parsing result based on the judgment strategy;
[0308] The search submodule is used to search for a query strategy corresponding to the target engine feature as the current query strategy.
[0309] Optionally, the parsing result includes: data source information and engine authority information;
[0310] Optionally, the parsing submodule includes:
[0311] An identification unit, used to identify original library table information and identity information of the user from the query request;
[0312] A search unit, used to search for a target data source corresponding to the original library table information;
[0313] The construction unit is used to retrieve the library table authorization information according to the identity information; extract all authorized engine information from the library table authorization information, and construct the engine permission information.
[0314] Optionally, the judgment strategy includes a plurality of ordered engine features;
[0315] Optionally, the feature determination submodule includes:
[0316] A first analysis unit, configured to use the first engine feature as a current engine feature;
[0317] A second analysis unit, used to determine whether the analysis result includes the current engine feature;
[0318] a third analyzing unit, configured to use the current engine feature as the target engine feature if the parsing result includes the current engine feature;
[0319] The loop unit is used to use the next engine feature as a new current engine feature if the parsing result does not include the current engine feature.
[0320] Optionally, the execution submodule 831 includes:
[0321] The first execution unit is configured to execute a first preset engine when the current query strategy is the first query strategy, and use the first preset engine as the target execution engine.
[0322] Optionally, the execution submodule 831 includes:
[0323] A second execution unit, configured to determine a target execution engine according to an execution status of the second query strategy when the current query strategy is the second query strategy;
[0324] Optionally, the second execution unit includes:
[0325] A preset requirement judgment subunit is used to judge whether the parsing result meets the preset requirements; the preset requirements include: the query statement includes a preset sub-statement, and / or the target data source is a preset data source type;
[0326] A first result subunit is configured to execute a second preset engine if the parsing result meets a preset requirement, and use the second preset engine as the target execution engine;
[0327] A second result subunit, configured to execute a third preset engine if the parsing result does not meet the preset requirement;
[0328] The execution update subunit is used to determine the target execution engine based on the execution status of the third preset engine.
[0329] Optionally, the execution update subunit includes:
[0330] If the execution result of the third preset engine is successful, taking the third preset engine as the target execution engine;
[0331] If the execution result of the third preset engine is failure, determining whether the data source information is in the presto blacklist;
[0332] If the data source information is in the presto blacklist, executing the fifth preset engine;
[0333] If the data source information is not in the presto blacklist, the fourth preset engine is executed; if the execution result of the fourth preset engine is successful, the fourth preset engine is used as the target execution engine; if the execution result of the fourth preset engine is failed, the fifth preset engine is executed;
[0334] If the execution result of the fifth preset engine is failure, it is determined that there is no target execution engine in the current query strategy.
[0335] Optionally, executing the fifth preset engine includes:
[0336] Acquire cluster resource information related to the query request;
[0337] Determine whether the cluster resource information contains the first field information; if the cluster resource information contains the first field information, use the BJMD cluster to perform the query;
[0338] If the cluster resource information does not include the first field information, determining whether the cluster resource information contains the first queue information; if the cluster resource information contains the first queue information, performing a query based on the first queue information;
[0339] If the first queue information does not exist in the cluster resource information, determining whether the second queue information exists in the cluster resource information; if the second queue information exists in the cluster resource information, performing a query based on the second queue information;
[0340] If the second queue information does not exist in the cluster resource information, determining whether the third queue information exists in the cluster resource information; if the third queue information exists in the cluster resource information, performing a query based on the third queue information;
[0341] If the third queue information does not exist in the cluster resource information, query is performed based on default queue information.
[0342] Optionally, the execution submodule 831 includes:
[0343] a third execution unit, configured to use the sixth preset engine as the current execution engine when the current query strategy is the third query strategy;
[0344] a fourth execution unit, configured to use the third preset engine as the current execution engine when the current query strategy is the fourth query strategy;
[0345] If the execution result of the current execution engine is successful, the current execution engine is used as the target execution engine; if the execution result of the current execution engine is failed, it is determined that there is no target execution engine in the current query strategy.
[0346] Optionally, the updating submodule 832 includes:
[0347] An updating unit, configured to, when the target execution engine does not exist in the current query strategy, call the loop unit to find the next engine feature and use it as a new current engine feature;
[0348] Invoking a second analysis unit to determine whether the parsing result includes the current engine feature;
[0349] If the analysis result includes the current engine feature, calling the third analysis unit to use the current engine feature as the target engine feature;
[0350] The search submodule is called to match the new current query strategy based on the target engine characteristics.
[0351] The functions of the system of the embodiment of the present invention have been described in the above method embodiment, so for details not fully described in this embodiment, please refer to the relevant description in the above embodiment, and no further description will be given here.
[0352] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0353] The present invention is described with reference to flowcharts and / or block diagrams of methods, systems (devices), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer programs / instructions. These computer programs / instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that instructions executed by the processor of the computer device or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0354] These computer programs / instructions may also be stored in a readable memory of a computer device capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the readable memory of the computer device produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0355] These computer programs / instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer device or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer device or other programmable device provide for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0356] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. An ad hoc query optimization system based on target engine features, characterized in that: include: The acquisition module is used to obtain the user's query request; A matching module, used to match the corresponding target engine features and the current query strategy for the query request in combination with the judgment strategy; An optimization module, used to update the current query strategy through an optimization model; wherein, the current query strategy is executed to obtain the execution result of the query strategy; when there is no target execution engine in the current query strategy, the target engine characteristics are updated according to the judgment strategy, and a new current query strategy is re-determined based on the updated target engine characteristics; The push module is used to push the query result of the target execution engine to the user.
2. An ad hoc query optimization method based on target engine characteristics, characterized in that: include: Get the user's query request; Matching the query request with the corresponding target engine features and the current query strategy in combination with the judgment strategy; The current query strategy is updated by optimizing the model; wherein the current query strategy is executed to obtain the execution result of the query strategy; when the target execution engine does not exist in the current query strategy, the target engine characteristics are updated according to the judgment strategy, and a new current query strategy is re-determined based on the updated target engine characteristics; The query result of the target execution engine is pushed to the user.
3. The ad hoc query optimization method based on target engine characteristics as claimed in claim 2, characterized in that: The combining the judgment strategy to match the query request with the corresponding target engine feature and the current query strategy includes: Parsing the query request to obtain a parsing result; Based on the judgment strategy, determining the target engine feature corresponding to the parsing result; A query strategy corresponding to the target engine feature is searched and used as the current query strategy.
4. The ad hoc query optimization method based on target engine characteristics as claimed in claim 3, characterized in that: The analysis results include: data source information and engine authority information; The query request is parsed to obtain a parsing result, including: Identifying original library table information and identity information of the user from the query request; Find the target data source corresponding to the original library table information; The library table authorization information is retrieved according to the identity information; all the authorized engine information is extracted from the library table authorization information to construct the engine permission information.
5. The ad hoc query optimization method based on target engine characteristics as claimed in claim 4, characterized in that: The judgment strategy includes a number of ordered engine features; The determining, based on the judgment strategy, the target engine feature corresponding to the parsing result includes: Using the first engine feature as the current engine feature; Determining whether the parsing result includes the current engine feature; If the parsing result includes the current engine feature, taking the current engine feature as the target engine feature; If the parsing result does not include the current engine feature, the next engine feature is used as a new current engine feature.
6. The ad hoc query optimization method based on target engine characteristics as claimed in claim 4, characterized in that: The executing the current query strategy includes: When the current query strategy is the first query strategy, the first preset engine is executed and the first preset engine is used as the target execution engine.
7. The ad hoc query optimization method based on target engine characteristics as claimed in claim 4, characterized in that: The executing the current query strategy includes: When the current query strategy is the second query strategy, determining whether the parsing result meets preset requirements; the preset requirements include: the query statement includes preset sub-statements, and / or the target data source is a preset data source type; If yes, execute the second preset engine and use the second preset engine as the target execution engine; If not, execute the third preset engine; and determine the target execution engine based on the execution status of the third preset engine.
8. The ad hoc query optimization method based on target engine characteristics as claimed in claim 7, characterized in that: The step of determining the target execution engine based on the execution status of the third preset engine includes: If the execution result of the third preset engine is successful, taking the third preset engine as the target execution engine; If the execution result of the third preset engine is failure, determining whether the data source information is in the presto blacklist; If the data source information is in the presto blacklist, executing the fifth preset engine; If the data source information is not in the presto blacklist, the fourth preset engine is executed; if the execution result of the fourth preset engine is successful, the fourth preset engine is used as the target execution engine; if the execution result of the fourth preset engine is failed, the fifth preset engine is executed; If the execution result of the fifth preset engine is failure, it is determined that there is no target execution engine in the current query strategy.
9. The ad hoc query optimization method based on target engine characteristics as claimed in claim 8, characterized in that: The executing the fifth preset engine comprises: Acquire cluster resource information related to the query request; Determine whether the cluster resource information contains the first field information; if the cluster resource information contains the first field information, use the BJMD cluster to perform the query; If the cluster resource information does not include the first field information, determining whether the cluster resource information contains the first queue information; if the cluster resource information contains the first queue information, performing a query based on the first queue information; If the first queue information does not exist in the cluster resource information, determining whether the second queue information exists in the cluster resource information; if the second queue information exists in the cluster resource information, performing a query based on the second queue information; If the second queue information does not exist in the cluster resource information, determining whether the third queue information exists in the cluster resource information; if the third queue information exists in the cluster resource information, performing a query based on the third queue information; If the third queue information does not exist in the cluster resource information, query is performed based on default queue information.
10. The ad hoc query optimization method based on target engine characteristics according to claim 4, characterized in that: The executing the current query strategy includes: When the current query strategy is the third query strategy, the sixth preset engine is used as the current execution engine; When the current query strategy is the fourth query strategy, the seventh preset engine is used as the current execution engine; If the execution result of the current execution engine is successful, the current execution engine is used as the target execution engine; if the execution result of the current execution engine is failed, it is determined that there is no target execution engine in the current query strategy.
11. The ad hoc query optimization method based on target engine characteristics according to claim 5, characterized in that: When the target execution engine does not exist in the current query strategy, updating the target engine feature according to the judgment strategy, and re-determining a new current query strategy based on the updated target engine feature, includes: When the target execution engine does not exist in the current query strategy, searching for the next engine feature and using it as a new current engine feature; Determining whether the parsing result includes the current engine feature; If the analysis result includes the current engine feature, the current engine feature is used as the target engine feature; Based on the target engine features, a new current query strategy is matched.
12. A computer device, characterized in that: The computer equipment includes: processor; and, A memory storing computer executable instructions, which when executed cause the processor to perform the method of any one of claims 2-11.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs / instructions, and when the one or more programs / instructions are executed by a processor, the method according to any one of claims 2 to 11 is implemented.
14. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the method according to any one of claims 2 to 11.
Citation Information
Cited By
Data query method and device, computer equipment, storage medium and program product
CN121412268A