Legal claims defining the scope of protection, as filed with the USPTO.
1. A method for dynamically selecting query execution operators, comprising: at a computing device having one or more processors, volatile memory, and non-volatile memory, executing one or more programs to retrieve data from a database, including: receiving a query; parsing the query to form a query execution tree; compiling the query execution tree to form a first executable plan that includes a plurality of in-memory operators that execute within the volatile memory without swapping to the non-volatile memory; initiating execution of the first executable plan, including initiating execution of a first plurality of in-memory operators in the first executable plan to run in parallel; while executing a first in-memory operator of the first plurality, detecting insufficient memory to complete execution of the first in-memory operator; and in response to detecting insufficient memory to complete execution of the first in-memory operator: aborting execution of the first executable plan; recompiling the query execution tree to form a second executable plan that replaces the first in-memory operator with a first spooling operator, wherein the first spooling operator executes within a fixed volatile memory budget and is configured to swap to non-volatile memory according to the fixed volatile memory budget; recompiling the query execution tree to form a third executable plan that retains the first in-memory operator, but schedules the first in-memory operator to execute not in parallel with the other in-memory operators of the first plurality; selecting a final executable plan to be the second executable plan or the third executable plan, according to estimated available volatile memory; executing the final executable plan to identify a set of results from the database that is responsive to the query; and returning the set of results.
2. The method of claim 1 , wherein: selecting the final executable plan is further based on analyzing historical information that includes execution statistics of the first in-memory operator and/or similar in-memory operators.
3. The method of claim 1 , wherein forming the second executable plan further replaces a second in-memory operator of the first plurality with a second spooling operator.
4. The method of claim 1 , wherein the third execution plan schedules one or more in-memory operators of the first plurality, in addition to the first in-memory operator, to execute not in parallel with the other in-memory operators of the first plurality.
5. The method of claim 1 , wherein aborting execution of the first executable plan includes: identifying a first portion of the first executable plan that has completed execution before the detection of insufficient memory; and storing intermediate results corresponding to the first portion; wherein executing the final executable plan includes reusing the stored intermediate results.
6. The method of claim 5 , wherein data storage for the first executable plan is in a first format that is different from a second data storage format used by the final executable plan, and storing the intermediate results comprises transforming data from the first format to the second format.
7. The method of claim 1 , further comprising: prior to compiling the query execution tree: analyzing historical information that includes execution statistics of one or more queries similar to the query to determine if usage of in-memory operators caused insufficient memory to complete execution; and in accordance with a determination that usage of in-memory operators caused insufficient memory to complete execution, compiling the query execution tree so that the first executable plan includes at least one spooling operator.
8. A database engine, comprising: one or more computing devices, each having one or more processors, memory, and one or more programs stored in the memory, wherein the one or more programs are configured for execution by the one or more processors and comprise instructions for: receiving a query; parsing the query to form a query execution tree; compiling the query execution tree to form a first executable plan that includes a plurality of in-memory operators that execute within the volatile memory without swapping to the non-volatile memory; initiating execution of the first executable plan, including initiating execution of a first plurality of in-memory operators in the first executable plan to run in parallel; while executing a first in-memory operator of the first plurality, detecting insufficient memory to complete execution of the first in-memory operator; and in response to detecting insufficient memory to complete execution of the first in-memory operator: aborting execution of the first executable plan; recompiling the query execution tree to form a second executable plan that replaces the first in-memory operator with a first spooling operator, wherein the first spooling operator executes within a fixed volatile memory budget and is configured to swap to non-volatile memory according to the fixed volatile memory budget; recompiling the query execution tree to form a third executable plan that retains the first in-memory operator, but schedules the first in-memory operator to execute not in parallel with the other in-memory operators of the first plurality; selecting a final executable plan to be the second executable plan or the third executable plan, according to estimated available volatile memory; executing the final executable plan to identify a set of results from the database that is responsive to the query; and returning the set of results.
9. The database engine of claim 8 , wherein: selecting the final executable plan is further based on analyzing historical information that includes execution statistics of the first in-memory operator and/or similar in-memory operators.
10. The database engine of claim 8 , wherein forming the second executable plan further replaces a second in-memory operator of the first plurality with a second spooling operator.
11. The database engine of claim 8 , wherein the third execution plan schedules one or more in-memory operators of the first plurality, in addition to the first in-memory operator, to execute not in parallel with the other in-memory operators of the first plurality.
12. The database engine of claim 8 , wherein aborting execution of the first executable plan includes: identifying a first portion of the first executable plan that has completed execution before the detection of insufficient memory; and storing intermediate results corresponding to the first portion; wherein executing the final executable plan includes reusing the stored intermediate results.
13. The database engine of claim 12 , wherein data storage for the first executable plan is in a first format that is different from a second data storage format used by the final executable plan, and storing the intermediate results comprises transforming data from the first format to the second format.
14. The database engine of claim 8 , wherein the one or more programs further comprise instructions for: prior to compiling the query execution tree: analyzing historical information that includes execution statistics of one or more queries similar to the query to determine if usage of in-memory operators caused insufficient memory to complete execution; and in accordance with a determination that usage of in-memory operators caused insufficient memory to complete execution, compiling the query execution tree so that the first executable plan includes at least one spooling operator.
15. A non-transitory computer readable storage medium storing one or more programs configured for execution by a computing device having one or more processors, volatile memory, and non-volatile memory, the one or more programs comprising instructions for: receiving a query; parsing the query to form a query execution tree; compiling the query execution tree to form a first executable plan that includes a plurality of in-memory operators that execute within the volatile memory without swapping to the non-volatile memory; initiating execution of the first executable plan, including initiating execution of a first plurality of in-memory operators in the first executable plan to run in parallel; while executing a first in-memory operator of the first plurality, detecting insufficient memory to complete execution of the first in-memory operator; and in response to detecting insufficient memory to complete execution of the first in-memory operator: aborting execution of the first executable plan; recompiling the query execution tree to form a second executable plan that replaces the first in-memory operator with a first spooling operator, wherein the first spooling operator executes within a fixed volatile memory budget and is configured to swap to non-volatile memory according to the fixed volatile memory budget; recompiling the query execution tree to form a third executable plan that retains the first in-memory operator, but schedules the first in-memory operator to execute not in parallel with the other in-memory operators of the first plurality; selecting a final executable plan to be the second executable plan or the third executable plan, according to estimated available volatile memory; executing the final executable plan to identify a set of results from the database that is responsive to the query; and returning the set of results.
16. The computer readable storage medium of claim 15 , wherein: selecting the final executable plan is further based on analyzing historical information that includes execution statistics of the first in-memory operator and/or similar in-memory operators.
17. The computer readable storage medium of claim 15 , wherein forming the second executable plan further replaces a second in-memory operator of the first plurality with a second spooling operator.
18. The computer readable storage medium of claim 15 , wherein the third execution plan schedules one or more in-memory operators of the first plurality, in addition to the first in-memory operator, to execute not in parallel with the other in-memory operators of the first plurality.
19. The computer readable storage medium of claim 15 , wherein aborting execution of the first executable plan includes: identifying a first portion of the first executable plan that has completed execution before the detection of insufficient memory; and storing intermediate results corresponding to the first portion; wherein executing the final executable plan includes reusing the stored intermediate results.
20. The computer readable storage medium of claim 19 , wherein data storage for the first executable plan is in a first format that is different from a second data storage format used by the final executable plan, and storing the intermediate results comprises transforming data from the first format to the second format.
Unknown
April 12, 2022
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.