Persistent query plans
AssigneeMicrosoft Corporation
InventorsConor Cunningham, Boris Baryshnikov, Xiaowei Jiang
Life of this patent
Estimating the term…
Abstract
A system and method for processing database queries. An optimizer produces query plans based on queries. Query plans are stored in a persistent storage. In response to receiving a query, the system selectively retrieves a stored query plan corresponding to the query for execution. Optimization of the query may be selectively performed. A stored query plan or a new query plan may be executed. Based on metrics collected during execution, the system may automatically revert to a stored plan other than the one being executed. Based on metrics of a reverted to plan, the system may roll back to the first plan. The persistent storage enables the use of query plans after a system restart, transfer to another device, or other changes.
Claims20
In a query processing system, a computer-based method comprising:
- a) maintaining a plurality of stored query plans in a persistent storage;
- and
- b) in response to receiving a query, performing actions including:
- i) based on the stored query plans, determining whether to produce a new query plan based on the query;
- ii) selectively designating a stored query plan to be a first query plan;
- iii) executing the first query plan;
- iv) selectively reverting execution of the first query plan to a second query plan of the stored query plans, based on one or more metrics corresponding to the execution of the first query plan.
A computer-readable storage medium comprising computer program instructions for processing queries, the program instructions executable by a processor in a computing device to perform actions including:
- a) compiling a plurality of queries to produce a plurality of query plans;
- b) storing the plurality of query plans in a persistent storage;
- c) in response to receiving a new query:
- i) selectively designating a stored query plan of the plurality of stored query plans as a first query plan to execute;
- ii) selectively optimizing the new query to produce a new query plan;
- iii) if a new query plan is produced, selectively designating the new query plan as the first query plan to execute;
- iv) executing the designated query plan;
- v) collecting one or more metrics based on executing the designated query plan;
- and
- vi) automatically determining whether to revert to a second query plan and execute the second query plan, based on the one or more metrics;
A computer-based query processing system, comprising:
- a) an optimizer that produces query plans based on representations of queries;
- b) a query plan storage manager that stores the produced query plans in a persistent storage;
- c) determining means for, in response to receiving a new query, determining a first query plan to execute, based on the stored query plans in the persistent store;
- d) an execution component that executes the first query plan;
- and
- e) means for automatically evaluating the execution of the determined query plan and determining whether to revert to a second query plan of the stored query plans;
- the execution component selectively executing the second query plan based on the determining whether to revert.
Dependencies are inferred from the claim text.