Query optimization method based on multimode database query optimizer

By identifying and analyzing the data access and calculation modes of cross-module queries in multi-mode databases, and combining expert knowledge to form a cross-module query meta plan, the problem of optimal access plan generation of cross-module queries in multi-mode databases is solved, and efficient query performance and reduced plan enumeration space are achieved.

CN119988426AActive Publication Date: 2025-05-13上海沄熹科技有限公司
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510061790.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-15
Publication Date
2025-05-13
Estimated Expiration
2045-01-15

AI Technical Summary

Technical Problem

The problem of generating optimal access plan for cross-module queries in multimode databases is complex, and the existing technology is difficult to effectively solve, resulting in low cross-module data access and computing efficiency.

Method used

By identifying cross-module queries, analyzing the access and calculation patterns of data objects, combining expert knowledge to form a cross-module query meta plan, and adjusting the connection relationship and access methods in the plan enumeration to generate the optimal access plan.

Benefits of technology

Targeted optimization for cross-module queries in multi-mode databases is achieved, query performance is improved, planned enumeration space is reduced, and efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988426A_ABST
    Figure CN119988426A_ABST
Patent Text Reader

Abstract

The invention discloses a query optimization method based on a multi-mode database query optimizer, and relates to the technical field of database management. Based on a multi-mode database query optimizer, the method comprises the following steps: step 1: carrying out cross-mode query identification, step 2: analyzing cross-mode sub-queries, step 3: combining an analysis result with expert knowledge in a cross-mode query scene to form a cross-mode query meta-plan, and taking the cross-mode query meta-plan as a plan guide before a final optimal access plan is generated. And 4, applying the cross-mode query meta-plan to plan enumeration to generate an optimal access plan.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention discloses a query optimization method based on a multi-mode database query optimizer, and relates to the technical field of database management. Background Art

[0002] A multi-model database is one that organically places the traditional relational model and its engine (relational database) with other types of database models and engines (such as time series database, graph database, vector database, etc.) in the same database, and can seamlessly collaborate between engines of various types to provide users and applications with a unified operation and computing interface.

[0003] In a multi-model database, because data from different data models are stored in different engines, the engines of different models will also have some optimization processing and calculation support unique to the model. It is very necessary to generate efficient access plans to organically and effectively integrate and analyze and calculate data from different models, so as to avoid unnecessary costs due to cross-model data access and calculation.

[0004] In the generation of the optimal access plan for SQL queries, plan enumeration including pruning algorithm is a key step, which determines the range of possible plans that need to be evaluated. As the number of data objects accessed in SQL queries increases, the number of plans to be evaluated will increase sharply due to the increase in optional different access methods, different object connection methods, and different connection orders. It is impossible to enumerate all possible plans and evaluate their costs to find the optimal access plan under limited time and space resources. This is a typical NP-hard problem in traditional database theory. In multi-mode databases, because data objects of different data models are introduced, more access modes, connection modes, connection orders, cross-mode computing operators, and different cross-mode data encoding and transmission costs brought by cross-model data objects will make the problem more complicated. At present, there is no method that can effectively solve the problem of optimal plan generation for optimizers in multi-mode databases. Summary of the invention

[0005] In view of the problems of the prior art, the present invention provides a query optimization method based on a multi-mode database query optimizer to solve the problems of cross-mode plan enumeration and access plan optimization involved in cross-mode queries in a multi-mode database.

[0006] The specific scheme proposed by the present invention is:

[0007] The present invention provides a query optimization method based on a multi-mode database query optimizer, which includes:

[0008] Step 1: Identify cross-model queries: parse the query syntax and semantics, and at each subquery level, identify whether the subquery is a cross-model subquery. If it is a cross-model subquery, analyze the cross-model subquery.

[0009] Step 2: Analyze cross-model subqueries: Analyze the access and data calculation patterns of data objects in subqueries, divide data objects of different model types according to model types and the connection relationship between data objects, take one data model type as the starting type, take the first data object of the data model type as the starting object, find all data objects that have a direct connection relationship with the starting object according to the connection relationship in the query, and group all data objects including the starting object according to model type to obtain analysis results.

[0010] Step 3: Combine the analysis results with the expert knowledge in the cross-modal query scenario to form a cross-modal query meta-plan. The cross-modal query meta-plan serves as a planning guide before generating the final optimal access plan.

[0011] Step 4: Apply the cross-module query meta-plan to the plan enumeration to generate the optimal access plan: In the plan enumeration stage, according to the relative access order of the data objects in the cross-module query meta-plan, adjust the connection relationship, connection method and access method between the data objects in the plan enumeration. According to the access order in the cross-module query meta-plan, the data objects are checked in the enumeration of the connection order of the data objects in the subquery. When encountering the data objects described in the meta-plan, according to the definition of the data object order, decide whether to intervene in the access order of the data objects, so as to form permutations and combinations between the data objects and generate different access order combinations, so as to generate the optimal access plan.

[0012] Furthermore, in step 1 of the query optimization method based on a multi-mode database query optimizer, cross-mode query identification is performed, including: identifying and judging the model type of each data object in the subquery, and recording the model type; if the subquery only involves data access and calculation of data objects of a single data model, then the processing continues according to the original processing logic; if the subquery involves data access and calculation of data objects of multiple models, then the subquery belongs to a cross-mode calculation subquery.

[0013] Furthermore, in step 3 of the query optimization method based on a multi-modal database query optimizer, the analysis result is combined with the expert knowledge in the cross-modal query scenario to form a cross-modal query meta-plan, including:

[0014] Combining expert knowledge, we know that for relational models and time series models, the data of the data objects in the time series model include relatively static attribute data and relatively dynamic measurement data. The tables of the relational model and the time series model are connected on the relatively static attribute data. For the calculation of time series data, on the relatively dynamic measurement data,

[0015] Therefore, for relational models and time series models, different pre-grouping aggregation strategies or different connection orders or access mode strategies are used to form a meta-plan for cross-model queries.

[0016] Furthermore, in step 4 of the query optimization method based on a multi-mode database query optimizer, according to the cross-mode query meta-plan, it is checked in the plan enumeration stage whether an access sequence combination that meets the meta-plan guidance exists. If the access sequence combination already exists, the access sequence combination is retained. If the access sequence combination does not exist, the commutative law and associativity are used to generate an access sequence combination that meets the guidance.

[0017] And the cost of the access order combinations that violate the meta-plan guidance marked in the enumeration phase is evaluated to avoid classifying them as reserved access order combinations.

[0018] The present invention also provides a query optimization device based on a multi-mode database query optimizer, which includes a recognition module, an analysis module, a meta-plan management module and an optimization module.

[0019] The recognition module performs cross-modal query recognition: it analyzes the syntax and semantics of the query and, at each subquery level, identifies whether the subquery is a cross-modal subquery. If it is a cross-modal subquery, it analyzes the cross-modal subquery.

[0020] The analysis module analyzes cross-model subqueries: analyzes the access and data calculation patterns of data objects in the subqueries, divides data objects of different model types according to model types and the connection relationship between data objects, takes one data model type as the starting type, takes the first data object of the data model type as the starting object, finds all data objects that have a direct connection relationship with the starting object according to the connection relationship in the query, and groups all data objects including the starting object according to the model type to obtain analysis results.

[0021] The meta-plan management module combines the analysis results with the expert knowledge in the cross-modal query scenario to form a cross-modal query meta-plan. The cross-modal query meta-plan serves as a planning guide before generating the final optimal access plan.

[0022] The optimization module applies the cross-modal query meta-plan to the plan enumeration to generate the optimal access plan: in the plan enumeration stage, according to the relative access order of the data objects in the cross-modal query meta-plan, the connection relationship, connection method and access method between the data objects in the plan enumeration are adjusted, wherein according to the access order in the cross-modal query meta-plan, the data objects are checked in the enumeration of the connection order of the data objects in the subquery, and when encountering the data objects described in the meta-plan, according to the definition of the data object order, it is decided whether to intervene in the access order of the data objects, so as to form permutations and combinations between the data objects and generate different access order combinations, so as to generate the optimal access plan.

[0023] Furthermore, the identification module of the query optimization device based on the multi-mode database query optimizer performs cross-mode query identification, including: identifying and judging the model type of each data object in the subquery, and recording the model type; if the subquery only involves data access and calculation of data objects of a single data model, then continue according to the original processing logic; if the subquery involves data access and calculation of data objects of multiple models, then the subquery belongs to a cross-mode calculation subquery.

[0024] Furthermore, the meta-plan management module of the query optimization device based on the multi-mode database query optimizer combines the analysis results with the expert knowledge in the cross-mode query scenario to form a cross-mode query meta-plan, including:

[0025] Combining expert knowledge, we know that for relational models and time series models, the data of the data objects in the time series model include relatively static attribute data and relatively dynamic measurement data. The tables of the relational model and the time series model are connected on the relatively static attribute data. For the calculation of time series data, on the relatively dynamic measurement data,

[0026] Therefore, for relational models and time series models, different pre-grouping aggregation strategies or different connection orders or access mode strategies are used to form a meta-plan for cross-model queries.

[0027] Furthermore, the optimization module of the query optimization device based on the multi-mode database query optimizer checks whether an access sequence combination that meets the meta-plan guidance exists in the plan enumeration stage according to the cross-mode query meta-plan. If the access sequence combination already exists, the access sequence combination is retained. If the access sequence combination does not exist, the commutative law and associativity are used to generate an access sequence combination that meets the guidance.

[0028] And the cost of the access order combinations that violate the meta-plan guidance marked in the enumeration phase is evaluated to avoid classifying them as reserved access order combinations.

[0029] The benefits of the present invention are:

[0030] It can optimize the generation of optimal access plans for cross-modal queries in multi-modal databases in a targeted manner.

[0031] The framework and algorithm of the present invention bring efficient performance to cross-modal query analysis of multi-modal databases.

[0032] It can effectively reduce the plan enumeration space of cross-modal queries in multi-modal databases.

[0033] Efficiently prune plans for cross-modal queries in multi-modal databases.

[0034] A more efficient optimizer framework is provided based on different cross-modal scenarios in multi-modal databases and combined with expert knowledge. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is a schematic flow chart of the method of the present invention. DETAILED DESCRIPTION

[0036] Nouns involved in the present invention:

[0037] Cross-model subquery: The data objects involved in the subquery of the query statement come from two or more data models, such as relational and time series data models, or relational, time series and graph data models, etc.

[0038] Cross-model query: One or more subqueries in the query statement are cross-model subqueries.

[0039] Pre-grouping aggregation: The query statement contains grouping aggregation. In order to optimize the access plan and performance, the partial grouping aggregation of the data in some data objects in the query without affecting the correctness of the final result is called pre-grouping aggregation. The result of pre-grouping aggregation is usually only an intermediate calculation result during the query execution process. Generally, there will be another grouping aggregation to ensure the final grouping aggregation result defined by the query.

[0040] Outside-in: From the perspective of a specific data model, usually a data model with a large amount of data access calculation in the query, the corresponding data access and calculation are completed in other data models, and then the data of the data objects of this model are used in this model for further calculation. This access order pattern between data objects is called the outside-in pattern.

[0041] Inside-out: Starting from a specific data model, usually a data model with a large amount of data access calculation in the query, the corresponding data access and calculation are completed in this data model first. Usually some pre-grouping and aggregation calculations are required to reduce the amount of data, and then further calculations are performed on the data objects in other models. This access order pattern between data objects is called the inside-out pattern.

[0042] Hybrid: The access order pattern between data objects that mixes the outside-in and inside-out modes is called hybrid mode.

[0043] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.

[0044] Example 1

[0045] The present invention provides a query optimization method based on a multi-mode database query optimizer, which includes:

[0046] Step 1: Perform cross-module query identification: parse the query syntax and semantics, and at each subquery level, identify whether the subquery is a cross-module subquery. If it is a cross-module subquery, analyze the cross-module subquery.

[0047] The cross-model query identification includes: identifying and judging the model type of each data object in the subquery, and recording the model type. If the subquery only involves data access and calculation of data objects of a single data model, the original processing logic is continued. If the subquery involves data access and calculation of data objects of multiple models, the subquery belongs to a cross-model calculation subquery. When any subquery in a query belongs to a cross-model calculation subquery, the query is also classified as a cross-model calculation query.

[0048] Step 2: Analyze cross-model subqueries: Analyze the access and data calculation patterns of data objects in the subqueries, divide data objects of different model types according to model types and the connectivity between data objects, take one data model type as the starting type, take the first data object of the data model type as the starting object, and find all data objects that have a direct connection relationship with the starting object based on the connection relationship in the query, and group all data objects including the starting object according to the model type to obtain analysis results.

[0049] The above analysis is repeated until all data objects in the subquery are added to a group. For data objects that are not directly connected, they are put into a separate grouping set and grouped according to the model type. Each grouping set can be called a data object module.

[0050] The access and connection mode and data calculation mode of the data objects in each data object module can be further analyzed. In order to avoid or reduce cross-module data transmission and transmission volume, the data access and calculation on all data objects of the model type should be completed once in a single model as much as possible. In the case of unavoidable cross-module data transmission, the amount of data that needs to be transmitted should be minimized. The calculation and minimization of the data volume here include applying all the filtering conditions that can be applied in the current stage to the data of the data objects within the model as much as possible, and performing any possible pre-grouping aggregation in the current stage, so that the total amount of data on the data objects of the model after filtering and pre-grouping aggregation will be greatly reduced. Therefore, the local predicates, connection predicates and grouping aggregation modes of the data objects of the model type involved in the query should be analyzed and evaluated, and the evaluation results should be recorded as part of the meta-plan.

[0051] The access method, connection order and connection method of data objects within each model type and the corresponding cost evaluation are still evaluated in the original way.

[0052] The access priority between model types is determined based on the total data size of the data objects within each model type after calculation. The data with a smaller total data size is accessed first, and so on. The overall access order is determined as part of the meta-plan.

[0053] Step 3: Combine the analysis results with the expert knowledge in the cross-modal query scenario to form a cross-modal query meta-plan, which serves as a planning guide before generating the final optimal access plan.

[0054] The analysis results are combined with expert knowledge in the cross-modal query scenario to form a cross-modal query meta-plan, including:

[0055] Combining expert knowledge, we know that for relational models and time series models, the data of the data objects in the time series model include relatively static attribute data and relatively dynamic measurement data. The tables of the relational model and the time series model are connected on the relatively static attribute data. For the calculation of time series data, on the relatively dynamic measurement data,

[0056] Therefore, for relational models and time series models, different pre-grouping aggregation strategies or different connection orders or access mode strategies are used to form meta-plans for cross-model queries. Different strategies are called meta-plans for cross-model queries. Here, the meta-plan can be regarded as a plan guide before generating the final optimal access plan, which is used to guide the optimizer to enumerate, evaluate, select and adjust the final cross-model access plan at various stages of finding the optimal query access plan.

[0057] Step 4: Apply the cross-module query meta-plan to the plan enumeration to generate the optimal access plan: In the plan enumeration stage, according to the relative access order of the data objects in the cross-module query meta-plan, adjust the connection relationship, connection method and access method between the data objects in the plan enumeration. According to the access order in the cross-module query meta-plan, the data objects are checked in the enumeration of the connection order of the data objects in the subquery. When encountering the data objects described in the meta-plan, according to the definition of the data object order, decide whether to intervene in the access order of the data objects, so as to form permutations and combinations between the data objects and generate different access order combinations, so as to generate the optimal access plan.

[0058] The connection relationship, connection method and access method between the data objects in the plan enumeration are adjusted. For example, when a query contains multiple tables of relational models and a table of time series model, the query needs to perform connection access and data grouping aggregation calculation on these tables. If all local filtering conditions in the query occur on the relational table, and there is no local filtering condition on the time series table, there are one or more connection predicates between the relational table and the time series table. The data volume of the time series table is often much larger than that of the relational table. From the perspective of the time series model, this data object access mode between model types belongs to the outside-in mode. According to the above-mentioned algorithm, the meta-plan of the analysis result will put the order of access and calculation of the relational table before the time series table. Therefore, when the optimizer enumerates possible plans, it only evaluates such an order according to the meta-plan guidance, and does not need to evaluate the opposite order. The advantage of this is that it specifically reduces the space for plan enumeration without missing out on better or optimal access plans. If all local filtering conditions in the query occur on the time series table, and there are no local filtering conditions on the relational table, and the data scale of the time series table's data access and calculation results is smaller than the data scale after calculation between the relational tables, this data object access mode between model types belongs to the inside-out mode from the perspective of the time series model. In this mode, a meta-plan guide is generated to access and calculate the time series table first, and then connect and calculate the relationship with the relational table, thereby guiding the optimizer to enumerate and evaluate such access and connection order, and finally obtain a better or optimal access plan; there is another scenario, that is, data filtering and calculation are performed on some tables of the relational model, and then further data filtering and calculation are performed on the tables of the time series model, and finally the remaining tables of the relational model are returned to perform data filtering and calculation. From the perspective of the time series model, this mode belongs to the hybrid mode, which first performs the outside-in stage, accesses and calculates data on some tables of the relational model, and then brings the results into the time series model for the inside-out stage, performs further data access, filtering and calculation on the tables of the time series model based on the brought-in results, and finally returns to the relational model to perform the final access and calculation on the calculation results and the remaining table data of the relational model.

[0059] In step 4, according to the cross-module query meta-plan, a check is made in the plan enumeration phase to see whether an access sequence combination that meets the meta-plan guidance exists. If the access sequence combination already exists, the access sequence combination is retained. If the access sequence combination does not exist, the commutative law and associativity are used to generate an access sequence combination that meets the guidance.

[0060] And the cost of the access order combinations that violate the meta-plan guidance marked in the enumeration phase is evaluated to avoid classifying them as reserved access order combinations.

[0061] Example 2

[0062] The present invention also provides a query optimization device based on a multi-mode database query optimizer, which includes a recognition module, an analysis module, a meta-plan management module and an optimization module.

[0063] The recognition module performs cross-modal query recognition: it analyzes the syntax and semantics of the query and, at each subquery level, identifies whether the subquery is a cross-modal subquery. If it is a cross-modal subquery, it analyzes the cross-modal subquery.

[0064] The analysis module analyzes cross-model subqueries: analyzes the access and data calculation patterns of data objects in the subqueries, divides data objects of different model types according to model types and the connection relationship between data objects, takes one data model type as the starting type, takes the first data object of the data model type as the starting object, finds all data objects that have a direct connection relationship with the starting object according to the connection relationship in the query, and groups all data objects including the starting object according to the model type to obtain analysis results.

[0065] The meta-plan management module combines the analysis results with the expert knowledge in the cross-modal query scenario to form a cross-modal query meta-plan. The cross-modal query meta-plan serves as a planning guide before generating the final optimal access plan.

[0066] The optimization module applies the cross-modal query meta-plan to the plan enumeration to generate the optimal access plan: in the plan enumeration stage, according to the relative access order of the data objects in the cross-modal query meta-plan, the connection relationship, connection method and access method between the data objects in the plan enumeration are adjusted, wherein according to the access order in the cross-modal query meta-plan, the data objects are checked in the enumeration of the connection order of the data objects in the subquery, and when encountering the data objects described in the meta-plan, according to the definition of the data object order, it is decided whether to intervene in the access order of the data objects, so as to form permutations and combinations between the data objects and generate different access order combinations, so as to generate the optimal access plan.

[0067] As the information interaction and execution process between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.

[0068] Likewise, the benefits of the device of the present invention are:

[0069] It can optimize the generation of optimal access plans for cross-modal queries in multi-modal databases in a targeted manner.

[0070] The framework and algorithm of the present invention bring efficient performance to cross-modal query analysis of multi-modal databases.

[0071] It can effectively reduce the plan enumeration space of cross-modal queries in multi-modal databases.

[0072] Efficiently prune plans for cross-modal queries in multi-modal databases.

[0073] A more efficient optimizer framework is provided based on different cross-modal scenarios in multi-modal databases and combined with expert knowledge.

[0074] It should be noted that not all steps and modules in the above-mentioned processes and device structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.

[0075] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.

Claims

1. A query optimization method based on a multi-mode database query optimizer, characterized in that Based on multi-mode database query optimizer, including: Step 1: Identify cross-model queries: parse the query syntax and semantics, and at each subquery level, identify whether the subquery is a cross-model subquery. If it is a cross-model subquery, analyze the cross-model subquery. Step 2: Analyze cross-model subqueries: Analyze the access and data calculation patterns of data objects in subqueries, divide data objects of different model types according to model types and the connection relationship between data objects, take one data model type as the starting type, take the first data object of the data model type as the starting object, find all data objects that have a direct connection relationship with the starting object according to the connection relationship in the query, and group all data objects including the starting object according to model type to obtain analysis results. Step 3: Combine the analysis results with the expert knowledge in the cross-modal query scenario to form a cross-modal query meta-plan. The cross-modal query meta-plan serves as a planning guide before generating the final optimal access plan. Step 4: Apply the cross-module query meta-plan to the plan enumeration to generate the optimal access plan: In the plan enumeration stage, according to the relative access order of the data objects in the cross-module query meta-plan, adjust the connection relationship, connection method and access method between the data objects in the plan enumeration. According to the access order in the cross-module query meta-plan, the data objects are checked in the enumeration of the connection order of the data objects in the subquery. When encountering the data objects described in the meta-plan, according to the definition of the data object order, decide whether to intervene in the access order of the data objects, so as to form permutations and combinations between the data objects and generate different access order combinations, so as to generate the optimal access plan.

2. According to the query optimization method based on a multi-modal database query optimizer according to claim 1, it is characterized in that the cross-modal query identification in step 1 comprises: Identify and determine the model type of each data object in the subquery, and record the model type. If the subquery only involves data access and calculation of data objects of a single data model, continue according to the original processing logic. If the subquery involves data access and calculation of data objects of multiple models, the subquery is a cross-model calculation subquery.

3. The query optimization method based on a multi-mode database query optimizer according to claim 1, characterized in that In step 3, the analysis results are combined with the expert knowledge in the cross-modal query scenario to form a cross-modal query meta-plan, including: Combining expert knowledge, we know that for relational models and time series models, the data of the data objects in the time series model include relatively static attribute data and relatively dynamic measurement data. The tables of the relational model and the time series model are connected on the relatively static attribute data. For the calculation of time series data, on the relatively dynamic measurement data, Therefore, for relational models and time series models, different pre-grouping aggregation strategies or different connection orders or access mode strategies are used to form a meta-plan for cross-model queries.

4. The query optimization method based on a multi-mode database query optimizer according to claim 1, characterized in that In step 4, according to the cross-module query meta-plan, in the plan enumeration stage, check whether the access sequence combination that meets the meta-plan guidance exists. If the access sequence combination already exists, the access sequence combination is retained. If the access sequence combination does not exist, the commutative law and associativity are used to generate an access sequence combination that meets the guidance. And the cost of the access order combinations that violate the meta-plan guidance marked in the enumeration phase is evaluated to avoid classifying them as reserved access order combinations.

5. A query optimization device based on a multi-mode database query optimizer, characterized in that Based on multi-mode database query optimizer, including identification module, analysis module, meta-plan management module and optimization module, The recognition module performs cross-modal query recognition: it analyzes the syntax and semantics of the query and, at each subquery level, identifies whether the subquery is a cross-modal subquery. If it is a cross-modal subquery, it analyzes the cross-modal subquery. The analysis module analyzes cross-model subqueries: analyzes the access and data calculation patterns of data objects in the subqueries, divides data objects of different model types according to model types and the connection relationship between data objects, takes one data model type as the starting type, takes the first data object of the data model type as the starting object, finds all data objects that have a direct connection relationship with the starting object according to the connection relationship in the query, and groups all data objects including the starting object according to the model type to obtain analysis results. The meta-plan management module combines the analysis results with the expert knowledge in the cross-modal query scenario to form a cross-modal query meta-plan. The cross-modal query meta-plan serves as a planning guide before generating the final optimal access plan. The optimization module applies the cross-modal query meta-plan to the plan enumeration to generate the optimal access plan: in the plan enumeration stage, according to the relative access order of the data objects in the cross-modal query meta-plan, the connection relationship, connection method and access method between the data objects in the plan enumeration are adjusted, wherein according to the access order in the cross-modal query meta-plan, the data objects are checked in the enumeration of the connection order of the data objects in the subquery, and when encountering the data objects described in the meta-plan, according to the definition of the data object order, it is decided whether to intervene in the access order of the data objects, so as to form permutations and combinations between the data objects and generate different access order combinations, so as to generate the optimal access plan.

6. The query optimization device based on a multi-mode database query optimizer according to claim 5, characterized in that The identification module performs cross-model query identification, including: identifying and judging the model type of each data object in the subquery, and recording the model type. If the subquery only involves data access and calculation of data objects of a single data model, it continues according to the original processing logic. If the subquery involves data access and calculation of data objects of multiple models, the subquery is a cross-model calculation subquery.

7. A query optimization device based on a multi-mode database query optimizer according to claim 5, characterized in that The meta-plan management module combines the analysis results with the expert knowledge in the cross-modal query scenario to form a cross-modal query meta-plan, including: Combining expert knowledge, we know that for relational models and time series models, the data of the data objects in the time series model include relatively static attribute data and relatively dynamic measurement data. The tables of the relational model and the time series model are connected on the relatively static attribute data. For the calculation of time series data, on the relatively dynamic measurement data, Therefore, for relational models and time series models, different pre-grouping aggregation strategies or different connection orders or access mode strategies are used to form a meta-plan for cross-model queries.

8. The query optimization device based on a multi-mode database query optimizer according to claim 5, characterized in that The optimization module checks whether there is an access sequence combination that meets the meta-plan guidance according to the cross-module query meta-plan in the plan enumeration stage. If the access sequence combination already exists, the access sequence combination is retained. If the access sequence combination does not exist, the commutative law and associativity are used to generate an access sequence combination that meets the guidance. And the cost of the access order combinations that violate the meta-plan guidance marked in the enumeration phase is evaluated to avoid classifying them as reserved access order combinations.

Citation Information

Patent Citations

  • Database query optimization method based on data constraint

    CN114328608A

  • Database query optimization method and system

    CN115098538A

  • Query optimization method, device and equipment

    CN117520381A

  • Query plan optimization method, system and equipment based on deep reinforcement learning and medium

    CN118445314A

  • Integration of existing databases into a sharding environment

    US20210081378A1