System-wide query optimization
AssigneeAmazon Technologies, Inc.
InventorsLiang Gang Yu, John Robert Smiley
Life of this patent
Estimating the term…
Abstract
A locally optimized plan for executing a command using a sequence of steps can be determined for a single computing node. However, the locally optimized sequence of steps may not be optimized for a combined system comprising multiple computing nodes, any one of which may be tasked with executing the command. A plan that is optimized for the combined system may be determined by comparing the predicted cost of locally optimized plans for computing nodes in the combined system.
Claims20
A non-transitory computer-readable storage medium having stored thereon instructions that, when executed by a computing device, cause the computing device to at least:
- obtain, from a first query optimizer of a first computing node, a first plan for executing a query on the first computing node;
- obtain, from a second query optimizer of a second computing node, a second plan for executing the query on the second computing node;
- obtain a first number of votes cast by the first computing node, wherein the first number of votes is based on a first characteristic of the first computing node;
- obtain a second number of votes cast by the second computing node for the second plan, wherein the second number of votes is based on a second characteristic of the second computing node;
- determine, based on comparing the first number of votes associated with a first predicted execution cost of executing the first plan with the second number of votes associated with a second predicted execution cost of executing the second plan, that the first plan for executing the query on the first computing node is preferred for executing the query on the second computing node, wherein the first predicted execution cost is based at least in part on a first performance characteristic of the first computing node and the second predicted execution cost is based at least in part on a second performance characteristic of the second computing node;
- and
- cause, based on the comparison, the second computing node to execute the query using the first plan.
A method of executing a query in a distributed database, the method comprising:
- receiving, from a first query optimizer, a first plan for executing a query on a first partition of the distributed database;
- receiving, from a second query optimizer, a second plan for executing the query on a second partition of the distributed database;
- determining a first predicted execution cost of executing the first plan and a second predicted execution cost of executing the second plan, wherein the first predicted execution cost is based at least on one or more first characteristics of computing resources associated with executing queries on the first partition;
- and
- causing the second computing device to execute the query using the first plan, based at least in part on comparing a first number of votes cast in favor of using the first plan and a second number of votes cast in favor of using the second plan.
A system, comprising:
- at least one processor;
- and
- at least one memory comprising instructions that, in response to being executed by the at least one processor, cause the system at least to:
- obtain, from a first query optimizer, a first plan for executing a query on a first computing node, the first plan generated on the first computing node;
- obtain, from a second query optimizer, a second plan for executing the query on a second computing node, the second plan generated on the second computing node;
- obtain a vote for the first plan, the vote cast for the first plan based on comparing a first predicted execution cost of executing the first plan on the first computing node and the second computing node with a second predicted execution cost of executing the second plan on the first computing node and the second computing node, that the first plan is preferred for executing the query on the second computing node;
- and
- cause, based on determining that the first plan is preferred based at least in part on the vote, the second computing node to execute the query using the first plan.
Dependencies are inferred from the claim text.