IP Library Granted Patent US 12,572,540
Granted Patent B2
US 12,572,540 · App. 18/746,409 · Granted Mar 10, 2026

Accelerated database query processing with complied code reuse

Inventors: Saksham Jain (San Francisco, CA); John Sherwood (San Francisco, CA); Zhou Sun (San Francisco, CA)
Assignee: SingleStore, Inc.
G06F16/24542G06F16/24549
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,572,540
App. No.
18/746,409
Granted
Mar 10, 2026
Kind
B2
Abstract

In an example there is provided a computer-implemented method which comprises generating an execution plan for a received user query, converting the execution plan into bytecode, compiling to unoptimized machine code using the bytecode and beginning execution of the execution plan by executing the unoptimized machine code, compiling optimized machine code using the bytecode whilst executing the unoptimized machine code; and switching to executing the optimized machine code in order to execute the execution plan, when the optimized machine code has been compiled.

Claims (52)

1 . A computer-implemented method comprising:

generating an execution plan for a received user query;

converting the execution plan into bytecode;

compiling the bytecode into an unoptimized machine code file and beginning execution of the unoptimized machine code file;

converting the bytecode into a language-independent intermediate representation;

determining that the language independent intermediate representation corresponds to a previously compiled machine code file; and

in response to determining that the language independent intermediate representation corresponds to a previously compiled machine code file, switching to executing the previously compiled machine code file.

2 . The computer-implemented method of claim 1 , wherein the determining that the language independent intermediate representation corresponds to a previously compiled machine code file comprises hashing the language-independent intermediate representation to determine a hash value and comparing the hash value with one or more other hash values corresponding to one or more previously compiled machine code files.

3 . The computer-implemented method of claim 1 , comprising:

generating another execution plan for another received user query;

converting the other execution plan into bytecode;

converting the bytecode into another language-independent intermediate representation;

determining that the other language independent intermediate representation does not correspond to a previously compiled machine code file and in response compiling the other language independent intermediate representation into a machine code file.

4 . The computer-implemented method of claim 3 , wherein compiling the language independent intermediate representation into the machine code file comprises converting the other language-independent intermediate representation into an optimized language-independent intermediate representation and compiling the optimized language-independent intermediate representation into an optimized machine code file.

5 . The computer-implemented method of claim 4 , wherein compiling the language independent intermediate representation into the optimized machine code file comprises:

compiling the bytecode into an unoptimized machine code file and beginning execution of the execution plan by executing the unoptimized machine code file;

compiling the bytecode into the optimized machine code file whilst executing the unoptimized machine code file;

switching from executing the unoptimized machine code file to executing the optimized machine code file in order to execute the execution plan, when the optimized machine code file has been compiled.

6 . The computer-implemented method of claim 5 , wherein compiling the optimized machine code file uses processor and memory resources to implement a first set of optimizations and compiling the unoptimized machine code file uses processor and memory resources to implement a second set of optimizations, wherein the first set of optimizations uses more processor and memory resources than the second set of optimizations.

7 . The computer-implemented method of claim 3 , comprising hashing the other language-independent intermediate representation to determine a hash value and adding the determined hash value to a lookup table comprising other hash values of other language-independent intermediate representations corresponding to other previously compiled machine code files.

8 . The computer-implemented method of claim 3 , wherein

the generating an execution plan for the received user query;

the converting the execution plan into bytecode;

the converting the bytecode into a language-independent intermediate representation; and

the executing the previously compiled machine code file to execute the execution plan

are performed on a first node;

and wherein the compiling the other language independent intermediate representation into machine code file is performed on a second node.

9 . The computer-implemented method of claim 8 , comprising selecting a node from a plurality of nodes as the second node, the selection dependent on the user query.

10 . The computer-implemented method of claim 9 , wherein the selecting a node comprises:

hashing the language-independent intermediate representation to calculate a hash value; and

performing a mathematical function on the hash value in order to select the second node.

11 . The computer-implemented method of claim 1 , wherein the language-independent intermediate representation comprises LLVM IR (intermediate representation).

12 . The computer-implemented method of claim 1 , wherein the bytecode comprises a number of bytecode instructions, the unoptimized machine code file being compiled using a lookup table of precompiled machine code portions each corresponding to a bytecode instruction.

13 . The computer-implemented method of claim 1 , wherein the unoptimized machine code file comprises a number of functions, each function associated with a machine code check portion arranged to check for availability of the precompiled machine code file before calling the function.

14 . The computer implemented method of claim 13 , each function of the unoptimized machine code file having a no-operation instruction which is replaced with a jump instruction pointing to a corresponding function in the precompiled machine code file.

15 . The computer-implemented method of claim 13 , comprising invoking a jump instruction to the unoptimized machine code file in response to determining that the language independent intermediate representation corresponds to the previously compiled machine code file, the jump instruction pointing to the previously compiled machine code file.

16 . A database system for executing a query on data stored in the database system, the database system comprising:

one or more hardware processors;

storage comprising computer-executable instructions which, when executed by the one or more processors, cause the database system to:

generate an execution plan for a received user query;

convert the execution plan into bytecode;

compile the bytecode into an unoptimized machine code file and beginning execution of the unoptimized machine code file;

convert the bytecode into a language-independent intermediate representation;

determine that the language independent intermediate representation corresponds to previously compiled machine code file; and

in response to a determination, by the database system, that the language independent intermediate representation corresponds to a previously compiled machine code file, switch to executing the previously compiled machine code file.

17 . A non-transitory computer-readable storage medium comprising computer-executable instructions which, when executed by one or more processors, cause the one or more processors to:

generate an execution plan for a received user query;

convert the execution plan into bytecode;

compile the bytecode into an unoptimized machine code file and beginning execution of the unoptimized machine code file;

convert the bytecode into a language-independent intermediate representation;

determine that the language independent intermediate representation corresponds to previously compiled machine code file; and

in response to a determination, by the one or more processors, that the language independent intermediate representation corresponds to a previously compiled machine code file, switch to executing the previously compiled machine code file.

Assignments (2)
PATENT SECURITY AGREEMENT Recorded Oct 20, 2025
From: SINGLESTORE, INC.
To: MONROE CAPITAL MANAGEMENT ADVISORS, LLC, AS AGENT
Reel/Frame 073122/0161 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 18, 2024
From: JAIN, SAKSHAM; SHERWOOD, JOHN; SUN, ZHOU
To: SINGLESTORE, INC.
Reel/Frame 067756/0131 →
Continuity (2)
Continuation 17558348 · Dec 21, 2021
Related Publication 20240338365A1 · Oct 10, 2024
References Cited (14)
US 9934051B1 · Ding · 2018 [cited by examiner]
US 12086574B1 · Vanderschaegen · 2024 [cited by examiner]
US 20160182409A1 · Kraemer · 2016 [cited by examiner]
US 20180260437A1 · Paroski · 2018 [cited by examiner]
US 20210133192A1 · Sun · 2021 [cited by examiner]
US 20210133193A1 · McConnell · 2021 [cited by examiner]
US 20220107812A1 · Foley · 2022 [cited by examiner]
US 20230014435A1 · Shanker · 2023 [cited by examiner]
US 20230128127A1 · Hristodorescu · 2023 [cited by examiner]
Xu et al: Copy-and-Patch Compilation, Nov. 26, 2020. [cited by applicant]
Thomas Neumann: Efficiently Compiling Efficient Query Plans for Modern Hardware; Proceedings of the VLDB Endowment vol. 4 Issue Jun. 9, 2011 pp. 539-550. [cited by applicant]
AsmJit Project: https://asmjit.com, copyright 2018-2021, access Dec. 21, 2021. [cited by applicant]
LLVM Compiler Infrastructure website, LLVM's Analysis and Transform Passes: https://llvm.org/docs/Passes.html, accessed Dec. 21, 2021. [cited by applicant]
The LLVM Compiler Infrastructure: https://llvm.org/, accessed Dec. 21, 2021. [cited by applicant]