IP Library Granted Patent US 12,339,882
Granted Patent B2
US 12,339,882 · App. 18/381,165 · Granted Jun 24, 2025

Adaptive interpretation and compilation of database queries

Inventors: Thomas Neumann (Munich, DE); Viktor Leis (Munich, DE); Alfons Kemper (Munich, DE); Tobias Muehlbauer (Munich, DE); Jan Finis (Munich, DE)
Assignee: Tableau Software, Inc.
G06F16/3332G06F16/23G06F16/334
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,339,882
App. No.
18/381,165
Granted
Jun 24, 2025
Kind
B2
Abstract

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.

Claims (83)

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 from a client;

translating the database query into an intermediate representation;

computing an estimated query execution time according to an estimated number of rows that will be accessed to retrieve a result set corresponding to the database query;

computing an estimated compilation time to compile the intermediate representation into machine executable code according to characteristics of the intermediate representation;

in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy a first optimized compilation criterion:

performing one or more optimization passes of a first type on the intermediate representation to form an optimized intermediate representation of a first type;

compiling the optimized intermediate representation of the first type to form optimized executable machine code of a first type; and

executing the optimized executable machine code of the first type to retrieve the result set from the database;

in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy a second optimized compilation criterion:

performing one or more optimization passes of a second type on the intermediate representation to form an optimized intermediate representation of a second type;

compiling the optimized intermediate representation of the second type to form optimized executable machine code of a second type, wherein the optimized executable machine code of the second type has a lower execution time than the optimized executable machine code of the first type; and

executing the optimized executable machine code of the second type to retrieve the result set from the database; and

returning the result set.

2. The method of claim 1 , wherein computing the estimated compilation time is based on at least one of:

a number of instructions in the intermediate representation;

types of instructions in the intermediate representation; and

a number of functions in the intermediate representation.

3. The method of claim 1 , 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.

4. The method of claim 1 , wherein:

the first optimized compilation criterion is satisfied when the estimated number of rows that will be accessed to retrieve the result set is greater than a first threshold but less than a second threshold; and

the second 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.

5. The method of claim 1 , further comprising computing a ratio of the estimated query execution time and the estimated compilation time, wherein:

the first optimized compilation criterion comprises a rule that the ratio is greater than a first threshold but less than a second threshold; and

the second optimized compilation criterion comprises a rule that the ratio is greater than the second threshold.

6. The method of claim 1 , wherein the first optimized compilation criterion and the second optimized compilation criterion partition a set of all pairs (e, c) of estimated query execution time, that are greater than a minimum estimated query execution time, and estimated compilation time into two disjoint regions.

7. The method of claim 1 , wherein in accordance with a determination that the database query includes a join operation for a first dataset and a second dataset, the estimated query execution time is adjusted by summing a first cardinality of the first data set and a second cardinality of the second dataset.

8. The method of claim 1 , further comprising:

in accordance with a determination that the optimized executable machine code of the first type is executed:

determining a compilation time for the optimized executable machine code of the first type; and

in accordance with a determination that the compilation time for the optimized executable machine code of the first type and the estimated compilation time are different, adjusting the estimated compilation time based on the compilation time for the optimized executable machine code of the first type.

9. The method of claim 8 , wherein, in accordance with a determination that the estimated compilation time has been adjusted, adjusting the first optimized compilation criterion and/or the second optimized compilation criterion.

10. The method of claim 1 , further comprising:

in accordance with a determination that the optimized executable machine code of the first type is executed:

determining a query execution time for the optimized executable machine code of the first type; and

in accordance with a determination that the query execution time for the optimized executable machine code of the first type and the estimated query execution time are different, adjusting the estimated query execution time based on the query execution time for the optimized executable machine code of the first type.

11. The method of claim 10 , wherein, in accordance with a determination that the estimated query execution time has been adjusted, adjusting the first optimized compilation criterion and/or the second optimized compilation criterion.

12. The method of claim 1 , further comprising:

in accordance with a determination that the optimized executable machine code of the second type is executed:

determining a compilation time for the optimized executable machine code of the second type; and

in accordance with a determination that the compilation time for the optimized executable machine code of the second type and the estimated compilation time are different, adjusting the estimated compilation time based on the compilation time for the optimized executable machine code of the second type.

13. The method of claim 12 , wherein, in accordance with a determination that the estimated compilation time has been adjusted, adjusting the first optimized compilation criterion and/or the second optimized compilation criterion.

14. The method of claim 1 , further comprising:

in accordance with a determination that the optimized executable machine code of the second type is executed:

determining a query execution time for the optimized executable machine code of the second type; and

in accordance with a determination that the query execution time for the optimized executable machine code of the second type and the estimated query execution time are different, adjusting the estimated query execution time based on the query execution time for the optimized executable machine code of the second type.

15. The method of claim 14 , wherein, in accordance with a determination that the estimated query execution time has been adjusted, adjusting the first optimized compilation criterion and/or the second optimized compilation criterion.

16. 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 from a client;

translating the database query into an intermediate representation;

computing an estimated query execution time according to an estimated number of rows that will be accessed to retrieve a result set corresponding to the database query;

computing an estimated compilation time to compile the intermediate representation into machine executable code according to characteristics of the intermediate representation;

in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy a first optimized compilation criterion:

performing one or more optimization passes of a first type on the intermediate representation to form an optimized intermediate representation of a first type;

compiling the optimized intermediate representation of the first type to form optimized executable machine code of a first type; and

executing the optimized executable machine code of the first type to retrieve the result set from a database;

in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy a second optimized compilation criterion:

performing one or more optimization passes of a second type on the intermediate representation to form an optimized intermediate representation of a second type;

compiling the optimized intermediate representation of the second type to form optimized executable machine code of a second type, wherein the optimized executable machine code of the second type has a lower execution time than the optimized executable machine code of the first type; and

executing the optimized executable machine code of the second type to retrieve the result set from the database; and

returning the result set.

17. The computer system of claim 16 , 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.

18. The computer system of claim 16 , wherein:

the first optimized compilation criterion is satisfied when the estimated number of rows that will be accessed to retrieve the result set is greater than a first threshold but less than a second threshold; and

the second 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.

19. The computer system of claim 16 , the one or more programs further comprising instructions for computing a ratio of the estimated query execution time and the estimated compilation time, wherein:

the first optimized compilation criterion comprises a rule that the ratio is greater than a first threshold but less than a second threshold; and

the second optimized compilation criterion comprises a rule that the ratio is greater than the second threshold.

20. 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 from a client;

translating the database query into an intermediate representation;

computing an estimated query execution time according to an estimated number of rows that will be accessed to retrieve a result set corresponding to the database query;

computing an estimated compilation time to compile the intermediate representation into machine executable code according to characteristics a size of the intermediate representation;

in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy a first optimized compilation criterion:

performing one or more optimization passes of a first type on the intermediate representation to form an optimized intermediate representation of a first type;

compiling the optimized intermediate representation of the first type to form optimized executable machine code of a first type; and

executing the optimized executable machine code of the first type to retrieve the result set from a database;

in accordance with a determination that the estimated query execution time and the estimated compilation time satisfy a second optimized compilation criterion:

performing one or more optimization passes of a second type on the intermediate representation to form an optimized intermediate representation of a second type;

compiling the optimized intermediate representation of the second type to form optimized executable machine code of the second type, wherein the optimized executable machine code of the second type has a lower execution time than the optimized executable machine code of the first type; and

executing the optimized executable machine code of the second type to retrieve the result set from the database; and

returning the result set.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 16, 2025
From: NEUMANN, THOMAS; LEIS, VIKTOR; KEMPER, ALFONS; MUEHLBAUER, TOBIAS; FINIS, JAN
To: TABLEAU SOFTWARE, INC.
Reel/Frame 071145/0382 →
CHANGE OF NAME Recorded May 16, 2025
From: TABLEAU SOFTWARE, INC.
To: TABLEAU SOFTWARE, LLC
Reel/Frame 071309/0944 →
Continuity (6)
Continuation 17371023 · Jul 8, 2021
Continuation 15890277 · Feb 6, 2018
Continuation 15700023 · Sep 8, 2017
Provisional Application 62532959 · Jul 14, 2017
Provisional Application 62418246 · Nov 6, 2016
Related Publication 20240134894A1 · Apr 25, 2024
References Cited (68)
US 5948038A · Daly · 1999 [cited by applicant]
US 6195449B1 · Bogden · 2001 [cited by applicant]
US 6411951B1 · Galindo-Legaria et al. · 2002 [cited by applicant]
US 6775681B1 · Ballamkonda et al. · 2004 [cited by applicant]
US 6865567B1 · Oommen et al. · 2005 [cited by applicant]
US 7035843B1 · Ballamkonda et al. · 2006 [cited by applicant]
US 7478080B2 · Pirahesh et al. · 2009 [cited by applicant]
US 7519990B1 · Xie · 2009 [cited by applicant]
US 7617179B2 · Nica · 2009 [cited by applicant]
US 7634459B1 · Eshet et al. · 2009 [cited by applicant]
US 7882100B2 · Andrei · 2011 [cited by applicant]
US 8356050B1 · Olston · 2013 [cited by applicant]
US 8465346B1 · Cattaneo · 2013 [cited by applicant]
US 8645346B2 · Dumitru · 2014 [cited by applicant]
US 8782619B2 · Wu et al. · 2014 [cited by applicant]
US 9195712B2 · Freedman et al. · 2015 [cited by applicant]
US 9202297B1 · Winters · 2015 [cited by applicant]
US 9413807B1 · Sherman · 2016 [cited by applicant]
US 9633076B1 · Morton · 2017 [cited by applicant]
US 9846724B2 · Weyerhauser et al. · 2017 [cited by applicant]
US 10089281B1 · Neumann et al. · 2018 [cited by applicant]
US 10089282B1 · Neumann et al. · 2018 [cited by applicant]
US 10325010B1 · Neumann et al. · 2019 [cited by applicant]
US 10353922B1 · Stolte · 2019 [cited by applicant]
US 10540425B2 · Neumann et al. · 2020 [cited by applicant]
US 10789416B2 · Neumann et al. · 2020 [cited by applicant]
US 11341132B2 · Ma et al. · 2022 [cited by applicant]
US 20030158842A1 · Levy et al. · 2003 [cited by applicant]
US 20040205078A1 · Galindo-Legaria et al. · 2004 [cited by applicant]
US 20050011391A1 · Jennings · 2005 [cited by applicant]
US 20050026118A1 · Chen · 2005 [cited by applicant]
US 20050027547A1 · Chen · 2005 [cited by applicant]
US 20060218123A1 · Chowdhuri · 2006 [cited by applicant]
US 20080209354A1 · Stanek · 2008 [cited by applicant]
US 20080313184A1 · Li · 2008 [cited by applicant]
US 20090106778A1 · Pomeroy · 2009 [cited by applicant]
US 20110055199A1 · Siddiqui et al. · 2011 [cited by applicant]
US 20110055585A1 · Lee · 2011 [cited by applicant]
US 20110316884A1 · Giambalvo et al. · 2011 [cited by applicant]
US 20120130940A1 · Gattani · 2012 [cited by applicant]
US 20120323956A1 · Dumitru et al. · 2012 [cited by applicant]
US 20150310082A1 · Han · 2015 [cited by applicant]
US 20150362325A1 · Shin · 2015 [cited by applicant]
US 20160269148A1 · Kim · 2016 [cited by applicant]
US 20170315740A1 · Corsi · 2017 [cited by applicant]
US 20180336223A1 · Kapoor · 2018 [cited by applicant]
Neumann, Office Action, U.S. Appl. No. 15/700,023,. [cited by applicant]
Neumann, Notice of Allowance, U.S. Appl. No. 15/700,023, Mar. 15, 2021, 9 pgs. [cited by applicant]
Neumann, Office Action, U.S. Appl. No. 15/719,479, Feb. 20, 2018, 8 pgs. [cited by applicant]
Neumann, Notice of Allowance, U.S. Appl. No. 15/719,479, Jul. 24, 2018, 10 pgs. [cited by applicant]
Neumann, Pre-Interview First Office Action, U.S. Appl. No. 15/885,646, May 3, 2018, 5 pgs. [cited by applicant]
Neumann, Notice of Allowance, U.S. Appl. No. 15/885,646, Jul. 18, 2018, 10 pgs. [cited by applicant]
Neumann, Office Action, U.S. Appl. No. 16/134,919, Jan. 24, 2019, 12 pgs. [cited by applicant]
Neumann, Notice of Allowance, U.S. Appl. No. 16/445,139, Sep. 17, 2019, 9 pgs. [cited by applicant]
Neumann, Office Action, U.S. Appl. No. 16/726,737, Feb. 18, 2020, 9 pgs. [cited by applicant]
Neumann, Notice of Allowance, U.S. Appl. No. 16/726,737, May 29, 2020, 9 pgs. [cited by applicant]
Neumann, Notice of Allowance, U.S. Appl. No. 15/890,277, Mar. 17, 2021, 11 pgs. [cited by applicant]
Neumann, Office Action, U.S. Appl. No. 17/037,505, Jun. 9, 2021, 12 pgs. [cited by applicant]
Neumann, Notice of Allowance, U.S. Appl. No. 17/037,505, Sep. 14, 2021, 9 pgs. [cited by applicant]
Neumann, Office Action, U.S. Appl. No. 17/368,767, Oct. 6, 2022, 15 pgs. [cited by applicant]
Neumann, Notice of Allowance, U.S. Appl. No. 17/368,767, Mar. 1, 2023, 9 pgs. [cited by applicant]
Neumann, Office Action, U.S. Appl. No. 17/371,023, Nov. 10, 2022, 15 pgs. [cited by applicant]
Neumann, Notice of Allowance, U.S. Appl. No. 17/371,023, Mar. 15, 2023, 9 pgs. [cited by applicant]
The Information Lab, Tips for using the Tableau Tooltip Tool, Aug. 20, 2015, YouTube, https://www.youtube.com/watch?v=D3WaD7gNVZk, 1 pg. [cited by applicant]
Neumann, Notice of Allowance, U.S. Appl. No. 16/134,919, Apr. 24, 2019, 9 pgs. [cited by applicant]
Leis, Viktor at el, “Efficient Processing of Window Functions in Analytical SQL Queries” ; published at Proceedings of the VLDB Endowment, vol. 8, No. 10 on Jun. 1, 2015 (Year: 2015). [cited by applicant]
Richard Wesley, “Windowing in DuckDB” available at https://duckdb.org/2021/10/13/windowing.html Published by DuckDB.org Year: 2021). [cited by applicant]
Vogelsgesang, Office Action, U.S. Appl. No. 18/119,821, Sep. 30, 2024, 46 pgs. [cited by applicant]