Hybrid Query Execution Engine for Database Performance
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Database management systems face delays in returning results to users due to the trade-off between fast compilation into byte code and quick execution, where compiling to machine code is faster overall but slower to start, and interpreting byte code is faster to initiate but slower overall, especially for large or complex queries.
Innovation Solution
A hybrid approach where operators are compiled into both byte code and machine code blocks, allowing execution to start quickly with byte code interpretation and switch to machine code as it becomes available, with parallel code generation and use of wrappers and helpers to optimize execution.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Speed
If operators are compiled into machine code blocks, then execution speed is improved, but initial compilation time increases
Solution Approach 1:
The system pre-compiles operators into machine code blocks before execution is needed. The code generation component compiles operators into machine code in advance, so that when the execution engine needs to run a query, the machine code is already available, eliminating compilation delays during actual execution.
Solution Approach 2:
The system dynamically switches between interpreting byte code and executing machine code blocks based on availability. The execution engine can start by interpreting byte code immediately while machine code is being compiled in the background, then transition to executing pre-compiled machine code blocks once they become available, optimizing the balance between immediate responsiveness and overall execution speed.
2Loss of time
If operators are interpreted from byte code, then start time is reduced, but overall execution time increases
Solution Approach 1:
Machine code blocks are pre-compiled into the database management system in advance, so that frequently used operators are already optimized and ready for execution. This preliminary compilation allows the system to achieve fast startup by interpreting byte code initially, then rapidly execute queries using the pre-compiled machine code blocks without incurring compilation delays during actual query processing.
Data Source
AI summary
In an example there is provided a computer-implemented method comprising generating an execution plan for a received user query in a structured query language, the execution plan having a number of operators for operating on data from a content database; compiling the operators into corresponding byte code and machine code; executing the operators by first interpreting the corresponding byte code; switching to executing the operators by executing the corresponding machine code when compiled.


