SQL execution plan verification
First Claim
1. A system comprising:
- a persistent storage device;
one or more processors, operatively coupled to the persistent storage device;
memory, operatively coupled to the one or more processors, storing instructions executable by the one or more processors;
wherein the instructions include instructions which, when executed by the one or more processors, cause;
generating query plans for executing database commands;
wherein the query plans include a first query plan for performing operations specified by a particular database command and a second query plan for performing the operations specified by the particular database command;
wherein the first query plan is a plan for performing the operations specified by the particular database command in a manner that is different than how the second query plan performs the operations specified by the particular database command;
storing, at the persistent storage device, verification data that identifies a first set of the query plans as having been designated as acceptable for executing database commands, and a second set of the query plans as awaiting verification;
wherein the verification data indicates that the first query plan is in the first set of query plans, and therefore designated as acceptable for executing the particular database command;
wherein the verification data indicates that the second query plan is in the second set of query plans, and therefore awaiting verification as to whether the second query plan is acceptable for executing the particular database command;
executing first query plans in the first set of query plans and second query plans in the second set of query plans;
wherein executing the first query plans includes executing the first query plan;
wherein executing the second query plans includes executing the second query plan;
performing comparisons of first performance statistics collected during execution of the first query plans in the first set of query plans to second performance statistics collected during execution of the second query plans in the second set of query plans;
wherein performing comparisons includes comparing performance statistics collected during execution of the first query plan with performance statistics collected during execution of the second query plan; and
based on the comparisons, updating the verification data to cause;
the first set to include the second query plan, andthe second set to cease to include the second query plan.
0 Assignments
0 Petitions
Accused Products
Abstract
Approaches, techniques, and mechanisms are disclosed for ensuring that a database command is executed according to a query plan that has been verified to be actually optimal. Except in rare circumstances, a database server does not execute a query plan unless it is first verified by the database server. The database server receives a request to execute a database command. The database server determines an unverified plan is the best plan for satisfying the request. Rather than risk the unknown behavior of an unverified plan, the database server instead satisfies the request according to a verified plan. Subsequently—for example as part of a scheduled job—the database server executes the unverified plan to determine performance statistics. Based at least on the performance statistics, the database server determines whether or not to verify the unverified plan. Techniques for concurrent and optimistic verifications are also disclosed.
194 Citations
24 Claims
-
1. A system comprising:
-
a persistent storage device; one or more processors, operatively coupled to the persistent storage device; memory, operatively coupled to the one or more processors, storing instructions executable by the one or more processors; wherein the instructions include instructions which, when executed by the one or more processors, cause; generating query plans for executing database commands; wherein the query plans include a first query plan for performing operations specified by a particular database command and a second query plan for performing the operations specified by the particular database command; wherein the first query plan is a plan for performing the operations specified by the particular database command in a manner that is different than how the second query plan performs the operations specified by the particular database command; storing, at the persistent storage device, verification data that identifies a first set of the query plans as having been designated as acceptable for executing database commands, and a second set of the query plans as awaiting verification; wherein the verification data indicates that the first query plan is in the first set of query plans, and therefore designated as acceptable for executing the particular database command; wherein the verification data indicates that the second query plan is in the second set of query plans, and therefore awaiting verification as to whether the second query plan is acceptable for executing the particular database command; executing first query plans in the first set of query plans and second query plans in the second set of query plans; wherein executing the first query plans includes executing the first query plan; wherein executing the second query plans includes executing the second query plan; performing comparisons of first performance statistics collected during execution of the first query plans in the first set of query plans to second performance statistics collected during execution of the second query plans in the second set of query plans; wherein performing comparisons includes comparing performance statistics collected during execution of the first query plan with performance statistics collected during execution of the second query plan; and based on the comparisons, updating the verification data to cause; the first set to include the second query plan, and the second set to cease to include the second query plan. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A method comprising:
-
generating query plans for executing database commands; wherein the query plans include a first query plan for performing operations specified by a particular database command and a second query plan for performing the operations specified by the particular database command; wherein the first query plan is a plan for performing the operations specified by the particular database command in a manner that is different than how the second query plan performs the operations specified by the particular database command; storing, at a persistent storage accessible to one or more computing devices, verification data that identifies a first set of the query plans as having been designated as acceptable for executing database commands, and a second set of the query plans as awaiting verification; wherein the verification data indicates that the first query plan is in the first set of query plans, and therefore designated as acceptable for executing the particular database command; wherein the verification data indicates that the second query plan is in the second set of query plans, and therefore awaiting verification as to whether the second query plan is acceptable for executing the particular database command; executing first query plans in the first set of query plans and second query plans in the second set of query plans; wherein executing the first query plans includes executing the first query plan; wherein executing the second query plans includes executing the second query plan; performing comparisons of first performance statistics collected during execution of the first query plans in the first set of query plans to second performance statistics collected during execution of the second query plans in the second set of query plans; wherein performing comparisons includes comparing performance statistics collected during execution of the first query plan with performance statistics collected during execution of the second query plan; and based on the comparisons, updating the verification data to cause; the first set to include the second query plan, and the second set to cease to include the second query plan; wherein the method is performed by the one or more computing devices. - View Dependent Claims (10, 11, 12, 13, 14, 15, 16)
-
-
17. One or more non-transitory computer-readable media, storing instructions that, when executed by one or more computing devices, cause performance of:
-
generating query plans for executing database commands; wherein the query plans include a first query plan for performing operations specified by a particular database command and a second query plan for performing the operations specified by the particular database command; wherein the first query plan is a plan for performing the operations specified by the particular database command in a manner that is different than how the second query plan performs the operations specified by the particular database command; storing, at a persistent storage accessible to one or more computing devices, verification data that identifies a first set of the query plans as having been designated as acceptable for executing database commands, and a second set of the query plans as awaiting verification; wherein the verification data indicates that the first query plan is in the first set of query plans, and therefore designated as acceptable for executing the particular database command; wherein the verification data indicates that the second query plan is in the second set of query plans, and therefore awaiting verification as to whether the second query plan is acceptable for executing the particular database command; executing first query plans in the first set of query plans and second query plans in the second set of query plans; wherein executing the first query plans includes executing the first query plan; wherein executing the second query plans includes executing the second query plan; performing comparisons of first performance statistics collected during execution of the first query plans in the first set of query plans to second performance statistics collected during execution of the second query plans in the second set of query plans; wherein performing comparisons includes comparing performance statistics collected during execution of the first query plan with performance statistics collected during execution of the second query plan; and based on the comparisons, updating the verification data to cause; the first set to include the second query plan, and the second set to cease to include the second query plan. - View Dependent Claims (18, 19, 20, 21, 22, 23, 24)
-
Specification