Adaptive interpretation and compilation of database queries

US11704347B2 · US · B2

Patent metadata
FieldValue
Publication numberUS-11704347-B2
Application numberUS-202117368767-A
CountryUS
Kind codeB2
Filing dateJul 6, 2021
Priority dateNov 6, 2016
Publication dateJul 18, 2023
Grant dateJul 18, 2023

How to read this patent

A practical reading order for non-experts. Skip the full description unless you need deep technical detail.

  1. Title

    What the patent document calls the invention.

  2. Abstract

    A short plain-language summary of the technical disclosure.

  3. Assignees and inventors

    Who owns or filed the patent and who is credited as inventor.

  4. Key dates

    Filing, priority, publication, and grant dates set the timeline.

  5. First independent claim

    The legal scope of protection — read this for what is actually claimed.

  6. CPC / IPC classifications

    Technology tags used to group this patent with similar filings.

  7. Citations and related patents

    Prior art links and similar publications in this corpus.

Abstract

Official abstract text for this publication.

A method executes at a computer system to retrieve data from a database. Upon receiving a database query, the computer system translates the query into an intermediate representation, and estimates a compilation time to compile the intermediate representation into machine executable code. The query execution time to retrieve a result set is also estimated. In accordance with a determination that the query execution time and compilation time satisfy an interpretation criterion, the computer system invokes a byte code interpreter to interpret the intermediate representation and retrieve the result set from the database. In accordance with a determination that the query execution and compilation times satisfy one of a plurality of compilation criteria, the computer system compiles the intermediate representation to form machine code and executes the machine code to retrieve the result set from the database. In some cases, the query intermediate representation is optimized prior to compilation.

First claim

Opening claim text (preview).

What is claimed is: 1. A method for retrieving data from a database, comprising: at a computer system having one or more processors and memory storing one or more programs configured for execution by the one or more processors: receiving a database query; determining an estimated query execution time for executing the database query and an estimated compilation time for at least partially compiling the database query; in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy an interpretation criterion, invoking a byte code interpreter to retrieve a result set from the database; in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy a compilation criterion, compiling an intermediate representation of the database query, and executing a compiled representation to retrieve the result set from the database; and in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy an optimized compilation criterion, optimizing and compiling the intermediate representation of the database query, and executing an optimized and compiled representation to retrieve the result set from the database. 2. The method of claim 1 , further comprising translating the database query into the intermediate representation, wherein the intermediate representation is specified in low level virtual machine (LLVM) code. 3. The method of claim 1 , wherein computing the estimated compilation time is based on at least one of a number of instructions, types of instructions, a number of functions, and a number of execution blocks in the intermediate representation, wherein each block comprises a maximal contiguous sequence of instructions without a jump instruction. 4. The method of claim 1 , wherein the interpretation criterion, the compilation criterion, and the optimized compilation criterion are determined using one or more test databases and a plurality of test database queries prior to receiving the database query. 5. The method of claim 1 , wherein the estimated query execution time is determined according to an estimated number of rows that will be accessed to retrieve the result set corresponding to the database query, and the interpretation criterion is satisfied when the estimated number of rows that will be accessed to retrieve the result set is less than or equal to a first threshold. 6. The method of claim 5 , wherein the compilation criterion is satisfied when the estimated number of rows that will be accessed to retrieve the result set is greater than the first threshold but less than a second threshold. 7. The method of claim 6 , wherein the optimized compilation criterion is satisfied when the estimated number of rows that will be accessed to retrieve the result set is greater than the second threshold. 8. The method of claim 1 , wherein the interpretation criterion, the compilation criterion, and the optimized compilation criterion are mutually exclusive. 9. The method of claim 1 , wherein, when the interpretation criterion is satisfied, the compilation criterion and the optimized compilation criterion are not evaluated. 10. The method of claim 1 , further comprising computing a ratio of the estimated execution time and the estimated query compilation time, wherein: the interpretation criterion comprises a rule that the ratio is less than a first threshold; the compilation criterion comprises a rule that the ratio is greater than a first threshold but less than a second threshold; and the optimized compilation criterion comprises a rule that the ratio is greater than the second threshold. 11. The method of claim 1 , wherein the interpretation criterion, the compilation criterion, and the optimized compilation criterion partition a set of all pairs (e, c) of estimated query execution time and estimated compilation time into three disjoint regions. 12. The method of claim 1 , wherein the database query is written in SQL. 13. A computer system having one or more computing devices, each computing device having one or more processors and memory, wherein the memory stores one or more programs configured for execution by the one or more processors, the one or more programs comprising instructions for: receiving a database query; determining an estimated query execution time for executing the database query and an estimated compilation time for at least partially compiling the database query; in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy an interpretation criterion, invoking a byte code interpreter to retrieve a result set from the database; in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy a compilation criterion: compiling an intermediate representation of the database query, and executing a compiled representation to retrieve the result set from the database; and in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy an optimized compilation criterion: optimizing and compiling the intermediate representation of the database query, and executing an optimized and compiled representation to retrieve the result set from the database. 14. The computer system of claim 13 , wherein computing the estimated compilation time is based on a number of execution blocks in the intermediate representation, wherein each block comprises a maximal contiguous sequence of instructions without a jump instruction. 15. The computer system of claim 13 , wherein: the estimated query execution time is determined according to an estimated number of rows that will be accessed to retrieve the result set corresponding to the database query; the interpretation criterion is satisfied when the estimated number of rows that will be accessed to retrieve the result set is less than or equal to a first threshold; the compilation criterion is satisfied when the estimated number of rows that will be accessed to retrieve the result set is greater than the first threshold but less than a second threshold; and the optimized compilation criterion is satisfied when the estimated number of rows that will be accessed to retrieve the result set is greater than the second threshold. 16. The computer system of claim 13 , further comprising computing a ratio of the estimated execution time and the estimated query compilation time, wherein: the interpretation criterion comprises a rule that the ratio is less than a first threshold; the compilation criterion comprises a rule that the ratio is greater than a first threshold but less than a second threshold; and the optimized compilation criterion comprises a rule that the ratio is greater than the second threshold. 17. A non-transitory computer readable storage medium storing one or more programs configured for execution by a computer system having one or more processors and memory, the one or more programs comprising instructions for: receiving a database query; determining an estimated query execution time for executing the database query and an estimated compilation time for at least partially compiling the database query; in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy an interpretation criterion, invoking a byte code interpreter to retrieve a result set from the database; in accordance with a determination that the estimated query

Assignees

Inventors

Classifications

  • Query translation · CPC title

  • Updating · CPC title

  • Query execution (filtering based on additional data G06F16/335) · CPC title

  • Query rewriting; Transformation · CPC title

Patent family

Related publications grouped by family.

External sources

Frequently asked questions

Answers are generated from the same data shown on this page.

What does patent US11704347B2 cover?
A method executes at a computer system to retrieve data from a database. Upon receiving a database query, the computer system translates the query into an intermediate representation, and estimates a compilation time to compile the intermediate representation into machine executable code. The query execution time to retrieve a result set is also estimated. In accordance with a determination tha…
Who is the assignee on this patent?
Tableau Software Inc
What technology area does this patent fall under?
Primary CPC classification G06F16/3332. Mapped technology areas include Physics.
When was this patent published?
Publication date Tue Jul 18 2023 00:00:00 GMT+0000 (Coordinated Universal Time) (B2). Legal status and post-grant events are not shown on this page.
What related patents are in patentsdb?
We list 11 related publications on this page (citations in our corpus or others sharing the same primary CPC).