SQL Execution Plan Baselines
First Claim
1. A method for executing database commands, the method comprising:
- persistently maintaining, for a particular command, baseline data indicating a plurality of acceptable plans for executing the particular command;
while persistently maintaining the baseline data, receiving a first request to execute the particular command;
estimating, for each plan in the plurality of acceptable plans, predicted costs for satisfying the first request according to the plan;
based on the predicted costs for each plan in the plurality of acceptable plans, selecting a particular plan from the set of acceptable plans; and
in response to the first request to execute the particular command, executing the particular command according to the particular plan.
1 Assignment
0 Petitions
Accused Products
Abstract
Approaches, techniques, and mechanisms are disclosed for maintaining a set of baseline query plans for a database command. Except in rare circumstances, a database server may only execute a command according to a baseline plan, even if the database server predicts that a different plan has a lower cost. The set of baseline plans are plans that, for one reason or another, have been determined to provide acceptable actual performance in at least one execution context. When the database server receives a request to execute a particular command, the database server, if possible, always executes the command according to the lowest predicted cost baseline plan. The database server may evolve the plan baseline to include additional plans by generating and testing new plans in response to new requests to execute the database command, or as part of a query optimization or tuning process.
105 Citations
22 Claims
-
1. A method for executing database commands, the method comprising:
-
persistently maintaining, for a particular command, baseline data indicating a plurality of acceptable plans for executing the particular command; while persistently maintaining the baseline data, receiving a first request to execute the particular command; estimating, for each plan in the plurality of acceptable plans, predicted costs for satisfying the first request according to the plan; based on the predicted costs for each plan in the plurality of acceptable plans, selecting a particular plan from the set of acceptable plans; and in response to the first request to execute the particular command, executing the particular command according to the particular plan. - View Dependent Claims (2, 3, 4, 5, 12, 13, 14, 15, 16)
-
-
6. A method for managing a set of acceptable execution plans for a database command, the method comprising:
-
persistently maintaining, for a particular command, baseline data indicating a plurality of acceptable plans for executing the particular command; while persistently maintaining the baseline data, receiving a first request to execute the particular command; generating a first plan for executing the particular command; if the first plan is in the plurality of acceptable plans, executing the particular command according to the first plan; and if the first plan is not in the plurality of acceptable plans; in response to the request to execute the particular command, executing the particular command according to a plan in the plurality of acceptable plans; adding the first plan to a set of potentially acceptable plans; subsequent to executing the particular command and adding the first plan to the set of potentially acceptable plans, determining that the plan is acceptable and adding the plan to the plurality of acceptable plans. - View Dependent Claims (7, 8, 9, 17, 18, 19, 20)
-
-
10. A method for managing a set of acceptable execution plans for a database command, the method comprising:
-
persistently maintaining, for a particular command, baseline data indicating a plurality of acceptable plans for executing the particular command; wherein the plurality of acceptable plans is such that, for a current execution context, if any plan in the plurality of acceptable plans is capable of correctly executing the particular command, the database server must execute the particular command according to one plan from the plurality of acceptable plans; during a query optimization process for the current execution context, storing profile data for the particular database command; in response to storing the profile data, determining a plan for executing the particular command in the current execution context, said determining being based on the profile data; and adding, to the baseline data, data indicating the determined plan. - View Dependent Claims (11, 21, 22)
-
Specification