A query optimization method based on a multi-model database query optimizer

By identifying and analyzing cross-modal queries in multi-modal databases and combining expert knowledge to generate cross-modal query meta-plans, the complexity of generating optimal access plans in multi-modal databases is solved, achieving efficient query optimization and performance improvement.

CN119988426BActive Publication Date: 2025-10-31上海沄熹科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In multi-model databases, how to effectively solve the problem of generating the optimal access plan in cross-model queries, especially since different data models introduce more access patterns, join patterns and cross-model computation operators, making plan enumeration complex and difficult to find the optimal plan with limited resources.

Method used

By identifying and analyzing the data object patterns of cross-modal subqueries through cross-modal queries, combining expert knowledge to form a cross-modal query meta-plan, and adjusting the access order during the plan enumeration stage to generate the optimal access plan, the multi-modal database query optimizer's identification, analysis, and optimization modules are used for processing.

Benefits of technology

It achieves targeted optimization of the generation of optimal access plans for cross-modal queries in multi-modal databases, reduces the plan enumeration space, and improves query optimization efficiency and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988426B_ABST
    Figure CN119988426B_ABST
Patent Text Reader

Abstract

This invention discloses a query optimization method based on a multi-model database query optimizer, relating to the field of database management technology. Based on the multi-model database query optimizer, the method includes: Step 1: identifying cross-model queries; Step 2: analyzing cross-model subqueries; Step 3: combining the analysis results with expert knowledge in the cross-model query scenario to form a cross-model query meta-plan, which serves as a plan guide before generating the final optimal access plan; Step 4: applying the cross-model query meta-plan to plan enumeration to generate the optimal access plan.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention discloses a query optimization method based on a multi-model database query optimizer, which relates to the field of database management technology. Background Technology

[0002] Multi-model databases organically combine traditional relational models and their engines (relational databases) with other types of database models and engines (such as time-series databases, graph databases, vector databases, etc.) in the same database, enabling seamless collaboration between various types of engines and providing users and applications with a unified operation and computing interface.

[0003] In multi-model databases, because data from different data models are stored in different engines, and different model engines also have some optimization processing and computational support specific to that model, it is essential to generate efficient access plans to organically and effectively integrate, analyze and compute data from different models, so as to avoid paying unnecessary costs due to cross-model data access and computation.

[0004] In the generation of optimal access plans for SQL queries, plan enumeration, including pruning algorithms, is a crucial step. It determines the range of possible plans to be evaluated. However, as the number of data objects accessed in the SQL query increases—due to the proliferation of different access methods, object join methods, and join orders—the number of plans to be evaluated rises dramatically. It becomes impossible to enumerate all possible plans and evaluate their costs to find the optimal access plan within limited time and space resources. This is a typical NP-hard problem in traditional database theory. In multi-model databases, the introduction of data objects from different data models further complicates the problem. The cross-model data objects bring even more access patterns, join patterns, join orders, cross-model computation operators, and different cross-model data encoding and transmission costs. Currently, there is no effective method to solve the optimal plan generation problem for optimizers in multi-model databases. Summary of the Invention

[0005] This invention addresses the problems of existing technologies by providing a query optimization method based on a multi-model database query optimizer, which solves the problems of cross-model plan enumeration and access plan optimization in cross-model queries in multi-model databases.

[0006] The specific solution proposed in this invention is as follows:

[0007] This invention provides a query optimization method based on a multi-model database query optimizer, the multi-model database query optimizer comprising:

[0008] Step 1: Cross-model query identification: Parse the syntax and semantics of the query. At each subquery level, identify whether the subquery is a cross-model subquery. If it is, analyze the cross-model subquery.

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

[0010] Step 3: Combine the analysis results with 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-modal query metaplan to plan enumeration to generate the optimal access plan: During the plan enumeration phase, adjust the connection relationships, connection methods, and access methods between data objects in the plan enumeration based on the relative access order of data objects in the cross-modal query metaplan. Specifically, during the enumeration of the connection order of data objects in the subquery, the data objects are checked according to the access order in the cross-modal query metaplan. When encountering data objects described in the metaplan, it is determined whether to intervene in the access order of the data objects based on the definition of the data object order, forming permutations and combinations between data objects to generate different access order combinations in order to generate the optimal access plan.

[0012] Furthermore, in step 1 of the query optimization method based on a multi-model database query optimizer, cross-model 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, the original processing logic continues. If the subquery involves data access and calculation of data objects of multiple models, the subquery belongs to cross-model calculation subquery.

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

[0014] Based on expert knowledge, it is known that, regarding relational models and time-series models, the data objects in a time-series model contain both relatively static attribute data and relatively dynamic measurement data. Tables in the relational model are connected to tables in the time-series model based on the relatively static attribute data, while calculations for the time-series data are performed on the relatively dynamic measurement data.

[0015] Therefore, for relational models and time-series models, different pre-grouping aggregation strategies, different join orders, or different access pattern 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-model database query optimizer, according to the cross-model query metaplan, during the plan enumeration phase, it checks whether a combination of access orders conforming to the metaplan guidance exists. If the access order combination already exists, it is retained; if the access order combination does not exist, the commutative law and associativity are used to generate a combination of access orders conforming to the guidance.

[0017] Furthermore, a cost assessment is performed on access order combinations that violate the metaplan guidance and are marked during the enumeration phase, to avoid classifying them as reserved access order combinations.

[0018] This invention also provides a query optimization device based on a multi-model database query optimizer, which includes an identification module, an analysis module, a meta-plan management module, and an optimization module.

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

[0020] The analysis module analyzes cross-model subqueries: it analyzes the access and computation patterns of data objects within the subqueries, categorizing data objects of different model types according to model type and the connections between them. Taking one data model type as the starting type, and the first data object of that model type as the starting object, it sequentially finds all data objects directly connected to the starting object based on the join relationships in the query. All data objects, including the starting object, are then grouped by model type to obtain the analysis results.

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

[0022] The optimization module applies the cross-modal query metaplan to plan enumeration to generate the optimal access plan. During the plan enumeration phase, based on the relative access order of data objects in the cross-modal query metaplan, the module adjusts the connection relationships, connection methods, and access methods between data objects in the plan enumeration. Specifically, based on the access order in the cross-modal query metaplan, the module checks the data objects during the enumeration of the connection order of data objects in the subquery. When encountering data objects described in the metaplan, the module decides whether to intervene in the access order of the data objects based on the definition of the data object order, forming permutations and combinations between data objects to generate different access order combinations in order to generate the optimal access plan.

[0023] Furthermore, the identification module of the query optimization device based on a multi-model database query optimizer 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 belongs to cross-model calculation subquery.

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

[0025] Based on expert knowledge, it is known that, regarding relational models and time-series models, the data objects in a time-series model contain both relatively static attribute data and relatively dynamic measurement data. Tables in the relational model are connected to tables in the time-series model based on the relatively static attribute data, while calculations for the time-series data are performed on the relatively dynamic measurement data.

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

[0027] Furthermore, the optimization module of the query optimization device based on a multi-model database query optimizer checks whether a combination of access orders conforming to the meta-plan exists during the plan enumeration phase, according to the cross-model query meta-plan. If the access order combination already exists, it is retained; if the access order combination does not exist, the commutative law and associativity are used to generate a combination of access orders conforming to the guidance.

[0028] Furthermore, a cost assessment is performed on access order combinations that violate the metaplan guidance and are marked during the enumeration phase, to avoid classifying them as reserved access order combinations.

[0029] The advantages of this invention are:

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

[0031] The framework and algorithm of this invention bring high performance to cross-model query analysis of multi-model databases.

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

[0033] Efficiently prune cross-model query plans in multi-model databases.

[0034] Based on different cross-modal scenarios in multimodal databases, a more efficient optimizer framework is provided by combining expert knowledge. Attached Figure Description

[0035] Figure 1 This is a schematic diagram of the method flow of the present invention. Detailed Implementation

[0036] The terms involved in this invention are:

[0037] Cross-model subqueries: Subqueries in a query statement involve data objects 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-modal query: A query statement contains one or more subqueries that are cross-modal subqueries.

[0039] Pre-grouping aggregation: When a query contains grouping aggregation, partial grouping aggregation is performed on some data objects in the query to optimize the access plan and performance without affecting the correctness of the final result. This is called pre-grouping aggregation. The result of pre-grouping aggregation is usually only an intermediate calculation result in the query execution process. There will usually be further grouping aggregation to ensure that the final grouping aggregation result defined by the query is obtained.

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

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

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

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

[0044] Example 1

[0045] This invention provides a query optimization method based on a multi-model database query optimizer, the multi-model database query optimizer comprising:

[0046] Step 1: Perform cross-model query identification: parse the syntax and semantics of the query, 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.

[0047] Cross-model query identification includes: identifying and determining 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 from a single data model, the original processing logic continues. If the subquery involves data access and calculation of data objects from multiple models, the subquery is classified as a cross-model computation subquery. When any subquery in a query is a cross-model computation subquery, the entire query is also classified as a cross-model computation query.

[0048] Step 2: Analyze cross-model subqueries: Analyze the access and calculation patterns of data objects in the subqueries. Divide the data objects of different model types according to the model type and the connection relationships between the 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 according to the connection relationships in the query. Group all data objects, including the starting object, according to the model type to obtain the analysis results.

[0049] The above analysis is repeated until all data objects in the subquery are added to a group. Data objects without direct join relationships are placed into a separate group set, also grouped according to model type. Each group set can be referred to as a data object module.

[0050] Further analysis can be conducted on the access and connection patterns and data computation patterns of data objects within each data object module. To avoid or reduce cross-module data transfer and its volume, data access and computation for all data objects of that model type should be completed within a single model as much as possible. In cases where cross-module data transfer is unavoidable, the amount of data to be transferred should be minimized. This computation and minimization of data volume includes applying all applicable filtering conditions to the data objects within the model at the current stage, and performing any possible pre-grouping aggregations at the current stage. This significantly reduces the total amount of data on the model's data objects after filtering and pre-grouping aggregation. Therefore, the local predicates, join predicates, and grouping aggregation patterns involving data objects of that model type in the query should be analyzed and evaluated, and the evaluation results recorded as part of the meta-plan.

[0051] The access methods, connection order, connection methods, and corresponding cost evaluations of data objects within each model type will still be evaluated in the original manner.

[0052] The access priority between model types is determined by the total data size of the data objects within each model type after data calculation. The smaller the total data size, the higher the access priority, and so on, thus determining the overall access order as part of the meta-plan.

[0053] Step 3: Combine the analysis results with 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.

[0054] The analysis results are combined with expert knowledge in cross-modal query scenarios to form a cross-modal query metaplan, including:

[0055] Based on expert knowledge, it is known that, regarding relational models and time-series models, the data objects in a time-series model contain both relatively static attribute data and relatively dynamic measurement data. Tables in the relational model are connected to tables in the time-series model based on the relatively static attribute data, while calculations for the time-series data are performed on the relatively dynamic measurement data.

[0056] Therefore, for relational and time-series models, different pre-grouping aggregation strategies, different join orders, or different access pattern strategies are used to form the meta-plan for cross-model queries. These different strategies are called the meta-plans for cross-model queries. Here, the meta-plan can be seen as a planning guide before generating the final optimal access plan, used to guide the optimizer in enumerating, evaluating, selecting, and adjusting the final cross-model access plan at various stages of finding the optimal query access plan.

[0057] Step 4: Apply the cross-modal query metaplan to plan enumeration to generate the optimal access plan: During the plan enumeration phase, adjust the connection relationships, connection methods, and access methods between data objects in the plan enumeration based on the relative access order of data objects in the cross-modal query metaplan. Specifically, during the enumeration of the connection order of data objects in the subquery, the data objects are checked according to the access order in the cross-modal query metaplan. When encountering data objects described in the metaplan, it is determined whether to intervene in the access order of the data objects based on the definition of the data object order, forming permutations and combinations between data objects to generate different access order combinations in order to generate the optimal access plan.

[0058] This involves adjusting the join relationships, join methods, and access methods between data objects in the plan enumeration. For example, when a query contains multiple relational model tables and one time-series model table, and the query needs to perform join access and data grouping and aggregation calculations on these tables, if all local filtering conditions in the query occur on the relational table, but there are no local filtering conditions on the time-series table, and there are one or more join 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 pattern between model types belongs to the outside-in pattern. According to the algorithm mentioned above, the metaplan of the analysis result will place the order of access and calculation of the relational table before that of the time-series table. Thus, when the optimizer enumerates possible plans, it will only evaluate this order according to the guidance of the metaplan, and will not have to evaluate the reverse order. The advantage of this is that it effectively reduces the space for plan enumeration without missing out on better or optimal access plans. However, if all local filtering conditions in the query occur on the time series table, while there are no local filtering conditions on the relational table, and the data size of the data access and calculation results of the time series table is smaller than the data size of the calculated data between the relational tables, then from the perspective of the time series model, this data object access mode between model types belongs to the inside-out mode. This model generates a meta-plan that prioritizes accessing and computing the time-series tables, followed by joining and computing relationships with the relational tables. This guides the optimizer to enumerate and evaluate the access and join order, ultimately arriving at a better or optimal access plan. Another scenario involves data filtering and computing on some relational model tables, followed by further data filtering and computing on the time-series model tables, and finally returning to the remaining relational model tables for data filtering and computing. From the perspective of the time-series model, this is a hybrid model. It first performs an outside-in phase, accessing and computing data on some relational model tables, then brings the results back to the time-series model for an inside-out phase, performing further data access, filtering, and computing on the time-series model tables based on the input results, and finally returning to the relational model to perform final access and computing on the remaining relational model table data.

[0059] Step 4 further checks whether a combination of access orders conforming to the metaplan exists during the plan enumeration phase, based on the cross-modal query metaplan. If the combination of access orders already exists, it is retained; otherwise, the commutative and associative laws are used to generate a combination of access orders conforming to the guidelines.

[0060] Furthermore, a cost assessment is performed on access order combinations that violate the metaplan guidance and are marked during the enumeration phase, to avoid classifying them as reserved access order combinations.

[0061] Example 2

[0062] This invention also provides a query optimization device based on a multi-model database query optimizer, which includes an identification module, an analysis module, a meta-plan management module, and an optimization module.

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

[0064] The analysis module analyzes cross-model subqueries: it analyzes the access and computation patterns of data objects within the subqueries, categorizing data objects of different model types according to model type and the connections between them. Taking one data model type as the starting type, and the first data object of that model type as the starting object, it sequentially finds all data objects directly connected to the starting object based on the join relationships in the query. All data objects, including the starting object, are then grouped by model type to obtain the analysis results.

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

[0066] The optimization module applies the cross-modal query metaplan to plan enumeration to generate the optimal access plan. During the plan enumeration phase, based on the relative access order of data objects in the cross-modal query metaplan, the module adjusts the connection relationships, connection methods, and access methods between data objects in the plan enumeration. Specifically, based on the access order in the cross-modal query metaplan, the module checks the data objects during the enumeration of the connection order of data objects in the subquery. When encountering data objects described in the metaplan, the module decides whether to intervene in the access order of the data objects based on the definition of the data object order, forming permutations and combinations between data objects to generate different access order combinations in order to generate the optimal access plan.

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

[0068] Similarly, the advantages of the device of the present invention are:

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

[0070] The framework and algorithm of this invention bring high performance to cross-model query analysis of multi-model databases.

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

[0072] Efficiently prune cross-model query plans in multi-model databases.

[0073] Based on different cross-modal scenarios in multimodal databases, a more efficient optimizer framework is provided by combining expert knowledge.

[0074] It should be noted that not all steps and modules in the above processes and device structures are mandatory; some steps or modules can be omitted as needed. The execution order of each step is not fixed and can be adjusted as required. The system structure described in the above 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 they may be jointly implemented by certain components in multiple independent devices.

[0075] The above-described embodiments are merely preferred embodiments provided to fully illustrate the present invention, and the scope of protection of the present invention is not limited thereto. Equivalent substitutions or modifications made by those skilled in the art based on the present invention are all within the scope of protection of the present invention. The scope of protection of the present invention is defined by the claims.

Claims

1. A query optimization method based on a multi-model database query optimizer, characterized by: A multi-model database query optimizer includes: Step 1: Cross-model query identification: Parse the syntax and semantics of the query. At each subquery level, identify whether the subquery is a cross-model subquery. If it is, analyze the cross-model subquery. Step 2: Analyze cross-model subqueries: Analyze the access and calculation patterns of data objects in the subqueries. Divide data objects of different model types according to model type and the connection relationships between data objects. Take one data model type as the starting type, and the first data object of that data model type as the starting object. Sequentially find all data objects that have a direct connection relationship with the starting object according to the connection relationships in the query. Group all data objects, including the starting object, according to model type to obtain the analysis results. Step 3: Combine the analysis results with 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-modal query metaplan to plan enumeration to generate the optimal access plan: During the plan enumeration phase, adjust the connection relationships, connection methods, and access methods between data objects in the plan enumeration based on the relative access order of data objects in the cross-modal query metaplan. Specifically, during the enumeration of the connection order of data objects in the subquery, the data objects are checked according to the access order in the cross-modal query metaplan. When encountering data objects described in the metaplan, it is determined whether to intervene in the access order of the data objects based on the definition of the data object order, forming permutations and combinations between data objects to generate different access order combinations in order to generate the optimal access plan.

2. The query optimization method based on a multi-model database query optimizer according to claim 1, characterized in that cross-model query identification is performed in step 1, including: The model type of each data object in the subquery is identified and recorded. If the subquery only involves data access and calculation of data objects of a single data model, the original processing logic continues. 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-model database query optimizer according to claim 1, characterized in that: Step 3 combines the analysis results with expert knowledge in the cross-modal query scenario to form a cross-modal query metaplan, including: Based on expert knowledge, it is known that, regarding relational models and time-series models, the data objects in a time-series model contain both relatively static attribute data and relatively dynamic measurement data. Tables in the relational model are connected to tables in the time-series model based on the relatively static attribute data, while calculations for the time-series data are performed on the relatively dynamic measurement data. Therefore, for relational models and time-series models, different pre-grouping aggregation strategies, different join orders, or different access pattern strategies are used to form a meta-plan for cross-model queries.

4. The query optimization method based on a multi-model database query optimizer according to claim 1, characterized in that: In step 4, based on the cross-modal query metaplan, during the plan enumeration phase, it is checked whether a combination of access orders conforming to the metaplan guide exists. If the combination of access orders already exists, it is retained; if the combination of access orders does not exist, the commutative law and associativity are used to generate a combination of access orders conforming to the guide. Furthermore, a cost assessment is performed on access order combinations that violate the metaplan guidance and are marked during the enumeration phase, to avoid classifying them as reserved access order combinations.

5. A query optimization device based on a multi-model database query optimizer, characterized in that: Based on a multi-model database query optimizer, including an identification module, an analysis module, a meta-plan management module, and an optimization module, The identification module performs cross-model query identification: it parses the syntax and semantics of the query, and at each subquery level, it identifies whether the subquery is a cross-model subquery. If it is, it analyzes the cross-model subquery. The analysis module analyzes cross-model subqueries: it analyzes the access and computation patterns of data objects within the subqueries, categorizing data objects of different model types according to model type and the connections between them. Taking one data model type as the starting type, and the first data object of that model type as the starting object, it sequentially finds all data objects directly connected to the starting object based on the join relationships in the query. All data objects, including the starting object, are then grouped by model type to obtain the analysis results. The meta-plan management module combines the analysis results with expert knowledge in cross-modal query scenarios to form a cross-modal query meta-plan. This meta-plan serves as a planning guide before generating the final optimal access plan. The optimization module applies the cross-modal query metaplan to plan enumeration to generate the optimal access plan. During the plan enumeration phase, based on the relative access order of data objects in the cross-modal query metaplan, the module adjusts the connection relationships, connection methods, and access methods between data objects in the plan enumeration. Specifically, based on the access order in the cross-modal query metaplan, the module checks the data objects during the enumeration of the connection order of data objects in the subquery. When encountering data objects described in the metaplan, the module decides whether to intervene in the access order of the data objects based on the definition of the data object order, forming permutations and combinations between data objects to generate different access order combinations in order to generate the optimal access plan.

6. A query optimization device based on a multi-model 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 belongs to cross-model calculation subquery.

7. A query optimization device based on a multi-model database query optimizer according to claim 5, characterized in that: The meta-plan management module combines the analysis results with expert knowledge in cross-modal query scenarios to form a cross-modal query meta-plan, including: Based on expert knowledge, it is known that, regarding relational models and time-series models, the data objects in a time-series model contain both relatively static attribute data and relatively dynamic measurement data. Tables in the relational model are connected to tables in the time-series model based on the relatively static attribute data, while calculations for the time-series data are performed on the relatively dynamic measurement data. Therefore, for relational models and time-series models, different pre-grouping aggregation strategies, different join orders, or different access pattern strategies are used to form a meta-plan for cross-model queries.

8. A query optimization device based on a multi-model database query optimizer according to claim 5, characterized in that: The optimization module checks whether a combination of access orders conforming to the metaplan exists during the plan enumeration phase, based on the cross-modal query metaplan. If the access order combination already exists, it is retained; otherwise, the commutative law and associativity are used to generate a combination of access orders conforming to the guide. Furthermore, a cost assessment is performed on access order combinations that violate the metaplan guidance and are marked during the enumeration phase, to avoid classifying them as reserved access order combinations.

Citation Information

Patent Citations

  • Database query optimization method and system

    CN115098538A

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

    CN118445314A