Using data in materialized query tables as a source for query optimization statistics
First Claim
1. A method of optimizing execution of a query that accesses data stored in one or more base tables in a database of a computer system, comprising:
- performing a first query that accesses the data stored in the base tables, in order to create at least one materialized query table (MQT);
using data stored in the MQT as statistics data for determining an optimal execution plan for a second query that accesses the data stored in the base tables; and
performing the second query using the optimal execution plan to access the data stored in the base tables in the database for presentation to a user.
4 Assignments
0 Petitions
Accused Products
Abstract
Data in materialized query tables (MQTs) are used as statistics for determining the optimal execution plan for a query. When an MQT is defined, it is examined to determine whether its data provides statistics for determining an optimal execution plan for a query. If so, then the MQT is identified, in the RDBMS, as a source for statistics. Information needed to exploit the MQT data as statistics is cataloged in the RDBMS. This information includes a characterization of the type of statistics provided by the MQT, the table and column distributions represented by those statistics, and a query for later retrieving relevant data from the MQT during the query optimization process. When a query is accepted for execution, the cataloged relevant information about MQTs is examined to determine whether an MQT exists that provides statistics relevant to optimization of the query. If such an MQT exists, then the relevant data is retrieved from the MQT using the cataloged query. Using the retrieved statistics, an optimal execution plan may be determined for the query.
33 Citations
29 Claims
-
1. A method of optimizing execution of a query that accesses data stored in one or more base tables in a database of a computer system, comprising:
-
performing a first query that accesses the data stored in the base tables, in order to create at least one materialized query table (MQT); using data stored in the MQT as statistics data for determining an optimal execution plan for a second query that accesses the data stored in the base tables; and performing the second query using the optimal execution plan to access the data stored in the base tables in the database for presentation to a user. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
-
-
15. A computer-implemented apparatus for optimizing execution of a query that accesses data stored in one or more base tables in a database of a computer system, comprising:
-
(a) a computer system having a data storage device coupled thereto, the data storage device storing the database; and (b) logic, performed by the computer system, for performing a first query that accesses the data stored in the base tables, in order to create at least one materialized query table (MQT);
for using data stored in the MQT as statistics data for determining an optimal execution plan for a second query that accesses the data stored in the base tables; and
for performing the second query using the optimal execution plan to access the data stored in the base tables in the database for presentation to a user.
-
-
16. An article of manufacture comprising a program storage device for storing instructions that, when read and executed by a computer system, result in the computer system performing a method of optimizing execution of a query that accesses data stored in one or more base tables in a database of the computer system, comprising:
-
performing a first query that accesses the data stored in the base tables, in order to create at least one materialized query table (MQT); using data stored in the MQT as statistics data for determining an optimal execution plan for a second query that accesses the data stored in the base tables; and performing the second query using the optimal execution plan to access the data stored in the base tables in the database for presentation to a user. - View Dependent Claims (17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29)
-
Specification