Portable and iterative re-usable suboptimization of database queries
First Claim
1. A method for optimizing a database query on a computer, the method comprising:
- generating a query plan for the database query, wherein the query plan includes first and second subplans;
retrieving cached optimization data associated with the first subplan and generated during evaluation of another query plan for a previous query that uses the first subplan, wherein the cached optimization data does not include cached query results, and wherein the cached optimization data is generated during evaluation of another query plan for a previous database query for which only partial optimization is completed and a portion of statistics collection for the other query plan is deferred;
evaluating by the hardware-implemented processor on the computer the first subplan for resource cost using the retrieved optimization data;
evaluating by the hardware-implemented processor on the computer the second subplan for resource cost; and
evaluating by the hardware-implemented processor on the computer the query plan for resource cost based upon the evaluations of resource cost for the first and second subplans.
1 Assignment
0 Petitions
Accused Products
Abstract
A method, apparatus and program product to optimize a database query. A query plan is generated for the database query where the query plan includes first and second subplans. Cached optimization data associated with the first subplan and generated during evaluation of another query plan for a previous query that uses the first subplan is retrieved. The first subplan is evaluated for resource cost using the retrieved optimization data. The second subplan is also evaluated for resource cost. The query plan is then evaluated for resource cost based upon the evaluations of resource cost for the first and second subplans. A query plan is selected based on evaluations of resource cost and the plan is executed to generate a result set.
39 Citations
25 Claims
-
1. A method for optimizing a database query on a computer, the method comprising:
-
generating a query plan for the database query, wherein the query plan includes first and second subplans; retrieving cached optimization data associated with the first subplan and generated during evaluation of another query plan for a previous query that uses the first subplan, wherein the cached optimization data does not include cached query results, and wherein the cached optimization data is generated during evaluation of another query plan for a previous database query for which only partial optimization is completed and a portion of statistics collection for the other query plan is deferred; evaluating by the hardware-implemented processor on the computer the first subplan for resource cost using the retrieved optimization data; evaluating by the hardware-implemented processor on the computer the second subplan for resource cost; and evaluating by the hardware-implemented processor on the computer the query plan for resource cost based upon the evaluations of resource cost for the first and second subplans. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
-
-
16. An apparatus comprising:
-
a processor; and program code configured to be executed by the processor to optimize a database query, the program code configured to generate a query plan for the database query wherein the query plan includes first and second subplans, retrieve cached optimization data associated with the first subplan and generated during evaluation of another query plan for a previous query that uses the first subplan wherein the cached optimization data does not include cached query results, evaluate the first subplan for resource cost using the retrieved optimization data, evaluate the second subplan for resource cost, and evaluate the query plan for resource cost based upon the evaluations of resource cost for the first and second subplans, wherein the cached optimization data is generated during evaluation of another query plan for a previous database query for which only partial optimization is completed and a portion of statistics collection for the other query plan is deferred. - View Dependent Claims (17, 18, 19, 20, 21, 22, 23, 24)
-
-
25. A program product, comprising:
-
a computer recordable-type medium; and a program code resident on the recordable-type medium and configured to optimize a database query, the program code further configured to generate a query plan for the database query wherein the query plan includes first and second subplans, retrieve cached optimization data associated with the first subplan and generated during evaluation of another query plan for a previous query that uses the first subplan wherein the cached optimization data does not include cached query results, evaluate the first subplan for resource cost using the retrieved optimization data, evaluate the second subplan for resource cost, and evaluate the query plan for resource cost based upon the evaluations of resource cost for the first and second subplans, wherein the cached optimization data is generated during evaluation of another query plan for a previous database query for which only partial optimization is completed and a portion of statistics collection for the other query plan is deferred.
-
Specification