Cost based materialized view selection for query optimization
First Claim
1. A method of selecting materialized views for use in execution of a database query, the method comprising:
- obtaining a table of alternatives having multiple entries for execution of the query;
selecting relevant materialized views for the query;
for each entry and view;
extracting an operator tree for the entry and the view;
matching operator trees for entries and views; and
if a match is found, extending the table of alternatives with the view.
3 Assignments
0 Petitions
Accused Products
Abstract
A query optimizer determines the applicability of materialized views to a query. View utilization alternatives are generated in the exploration stage of optimization, so that interaction with other transformations in complex queries is taken into account. A final decision on whether to use a materialized view is based on estimated cost. The optimizer generates a table of alternatives, which compactly encodes the various possibilities for each sub-expression of the query. Optimal-cost operator trees are extracted from this table. Materialized views are detected and substituted during exploration of the various possibilities and added to the table of alternatives. Materialized views and the alternatives are selected for use in a query execution plan based on cost. When two operator trees are not identical, a residual operator can be used if one operator tree subsumes the other operator tree. The residual expression can contain operators such as filters, group by and join.
-
Citations
41 Claims
-
1. A method of selecting materialized views for use in execution of a database query, the method comprising:
-
obtaining a table of alternatives having multiple entries for execution of the query;
selecting relevant materialized views for the query;
for each entry and view;
extracting an operator tree for the entry and the view;
matching operator trees for entries and views; and
if a match is found, extending the table of alternatives with the view. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
using a cost based optimizer to select an execution plan based on the augmented table of alternatives.
-
-
9. A machine readable medium having instructions for causing a computer to perform a method of selecting materialized views for use in execution of a database query, the method comprising:
-
obtaining a table of alternatives having multiple entries for execution of the query;
selecting relevant materialized views for the query;
for each entry and view;
extracting an operator tree for the entry and the view;
matching operator trees for entries and views; and
if a match is found, extending the table of alternatives with the view. - View Dependent Claims (10, 11, 12, 13, 14, 15, 16)
using a cost based optimizer to select an execution plan based on the augmented table of alternatives.
-
-
17. A query optimizer that selects materialized views for use in execution of a database query, the query optimizer comprising:
-
means for obtaining a table of alternatives having multiple entries for execution of the query;
means for selecting relevant materialized views for the query;
for each entry and view;
means for extracting an operator tree for the entry and the view;
means for matching operator trees for entries and views; and
if a match is found, extending the table of alternatives with the view. - View Dependent Claims (18, 19, 20, 21, 22, 23, 24)
means for selecting an execution plan based on the augmented table of alternatives using a cost based optimizer.
-
-
25. A method of selecting materialized views for use in execution of a database query, the method comprising:
-
obtaining a table of alternatives for execution of the query;
augmenting the table of alternatives with selected materialized views; and
using a cost based optimizer to select an execution plan based on the augmented table of alternatives.
-
-
26. A computer readable medium having instructions to perform a method of selecting materialized views for use in execution of a database query, the method comprising:
-
obtaining a table of alternatives for execution of the query;
augmenting the table of alternatives with selected materialized views; and
using a cost based optimizer to select an execution plan based on the augmented table of alternatives.
-
-
27. A method of selecting materialized views for use in execution of a database query, the method comprising:
-
obtaining a table of alternative entries for execution of the query;
selecting relevant views for the query;
matching relevant views with each entry;
augmenting the table of alternative entries with select matching materialized views; and
using a cost based optimizer to select an execution plan based on the augmented table of alternatives.
-
-
28. A method of selecting materialized views for use in execution of a database query, the method comprising:
-
obtaining a table of alternatives having multiple entries for execution of the query;
selecting relevant materialized views for the query;
for each entry and view;
extracting an operator tree for the entry and the view;
attempting a subsumption map from a definition of the materialized view to the operator tree;
matching operator trees for entries and views; and
if a match is found, extending the table of alternatives with the view. - View Dependent Claims (29, 30, 31, 32, 33, 34, 35, 36, 37, 38)
using a cost based optimizer to select an execution plan based on the augmented table of alternatives.
-
-
39. A computer readable medium having instructions for causing a computer to perform a method of selecting materialized views for use in execution of a database query, the method comprising:
-
obtaining a table of alternatives having multiple entries for execution of the query;
selecting relevant materialized views for the query;
for each entry and view;
extracting an operator tree for the entry and the view;
attempting a subsumption map from a definition of the materialized view to the operator tree;
matching operator trees for entries and views; and
if a match is found, extending the table of alternatives with the view.
-
-
40. A method of selecting materialized views for use in execution of a database query, the method comprising:
-
obtaining a table of alternatives having multiple entries for execution of the query;
selecting relevant materialized views for the query;
for each entry and view;
extracting an operator tree for the entry by collapsing operators into a query graph extracting an operator tree for the view by collapsing operators into a query graph;
attempting a subsumption map from a definition of the materialized view to the operator tree;
if the subsumption map attempt is successful, defining residual operations;
matching operator trees for entries and views;
if a match is found, extending the table of alternatives with the view by adding a root operator; and
using a cost based optimizer to select an execution plan based on the augmented table of alternatives.
-
-
41. A computer readable medium having instructions for causing a computer to perform a method of selecting materialized views for use in execution of a database query, the method comprising:
-
obtaining a table of alternatives having multiple entries for execution of the query;
selecting relevant materialized views for the query;
for each entry and view;
extracting an operator tree for the entry by collapsing operators into a query graph extracting an operator tree for the view by collapsing operators into a query graph;
attempting a subsumption map from a definition of the materialized view to the operator tree;
if the subsumption map attempt is successful, defining residual operations;
matching operator trees for entries and views;
if a match is found, extending the table of alternatives with the view by adding a root operator; and
using a cost based optimizer to select an execution plan based on the augmented table of alternatives.
-
Specification