Systematic approach to query optimization
First Claim
1. A method of systematically optimizing the processing of a query in a database management system that operates in a computer network, the method comprising:
- a) receiving the executable data query;
b) producing a query plan by applying to the query a relational tableau chase procedure comprising logical constraints which capture all relevant elements for implementation mapping of the query;
c) rewriting the query against a logical schema into an equivalent universal query plan written against a physical schema, given a semantic relationship between the logical schema and the physical schema that explicitly uses all relevant physical structures in the implementation;
d) applying to the universal plan a sequence of backchase steps, which systematically combine use of indexes, materialized views, semantic optimization and minimization, to remove redundancies, joins and scans;
e) generating an alternative cost-based optimal query plan; and
f) executing said optimal query plan.
1 Assignment
0 Petitions
Accused Products
Abstract
The present invention demonstrates the development and application of the chase/backchase (“C&B”) technique to systematically optimize generating alternative query plans, aimed at multiple disparate targets. It further provides a first optimization prototype that uses path-conjunctive query graphs internally. The methods, systems, apparatus and techniques of the present invention capture and extend many aspects of semantic optimizations, physical data independence, use of materialized views and cached queries, as well as generalized tableau-like minimization. Moreover, using a uniform representation with constraints, the techniques make these disparate optimization principles highly cooperative.
This present invention provides a new class of optimization opportunities, such as the non-trivial use of indexes and materialized views enabled only by the presence of certain integrity constraints. Moreover, the technique is valuable when only the presence of semantic integrity constraints enables the use of physical access structures or materialized views.
-
Citations
20 Claims
-
1. A method of systematically optimizing the processing of a query in a database management system that operates in a computer network, the method comprising:
-
a) receiving the executable data query;
b) producing a query plan by applying to the query a relational tableau chase procedure comprising logical constraints which capture all relevant elements for implementation mapping of the query;
c) rewriting the query against a logical schema into an equivalent universal query plan written against a physical schema, given a semantic relationship between the logical schema and the physical schema that explicitly uses all relevant physical structures in the implementation;
d) applying to the universal plan a sequence of backchase steps, which systematically combine use of indexes, materialized views, semantic optimization and minimization, to remove redundancies, joins and scans;
e) generating an alternative cost-based optimal query plan; and
f) executing said optimal query plan. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A database management system, comprising:
-
a database having a plurality of records;
means for accessing and rewriting a query into a universal plan in accordance with a tableau chase procedure based on declarative constraints;
an optimizer for optimizing a query accessing said relational database, by rewriting with the tableau chase procedure the query into a universal plan, followed by a sequence of backchase procedure steps based in part on declarative constraints which eliminate redundancies in the universal plan to reduce cost;
wherein said rewrite rules are expressed in a high-level declarative language, and said query against a logical schema is rewritten into an equivalent universal query plan written against a physical schema, given a semantic relationship between the logical schema and the physical schema;
wherein said optimizer uses said rewrite rules to generate query plans that are minimal in the number of scans and joins it performs;
means for applying to said minimal query plans any cost-based query optimization procedure to produce a globally optimal plan; and
means for executing said optimal plan. - View Dependent Claims (10, 11, 12)
-
-
13. A query optimization system for systematically optimizing a query invoking database tables, said system comprising:
-
means for providing a high-level declarative language, and declarative chase and backchase rules to rewrite a query written against a logical schema into an equivalent universal query plan written against a physical schema, given a semantic relationship between the logical schema and the physical schema;
means for generating alternative queries from the query and rewrite rules;
means for generating query plans that is minimal in the number of scans and joins it performs;
means for applying to said minimal query plans any cost-based query optimization procedure to produce a globally optimal plan; and
means for executing said optimal plan. - View Dependent Claims (14, 15, 16)
-
-
17. An apparatus for use in systematically optimizing a query in a database system, wherein the apparatus comprises:
-
memory for storing at least one data item referenced by the query; and
a processor coupled to the memory and operative to (i) systematically apply to the query a tableau chase procedures and a sequence of backchase procedure steps based in part on declarative constraints along with one or more algebraic rewritings based on explicit substitutions in order to generate a rewritten universal query plan and rewritten query plans that are minimal in the number of scans and joins performed, which are equivalent to the query, wherein each of at least a subset of equivalent substitutions represents a hypothetical database change;
(ii) applying to said minimal query plans any cost-based query optimization procedure to produce a globally optimal plan; and
(iii) execute said optimal plan.- View Dependent Claims (18, 19, 20)
-
Specification