Dynamic Inlining Framework for Database Query Compilation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The compilation time of generated code for database queries is increased due to the need to access and manipulate complex data structures, which can mitigate the benefits of code generation in speeding up query execution.
Innovation Solution
Pre-compiling data structure functions into library modules expressed in an intermediate representation, allowing them to be linked and optimized independently of query processing, and loaded as machine executable code for faster execution.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Speed
If code generation is used to speed up SQL query execution, then query execution speed is improved, but compilation time of generated code increases due to complex data structure access
Solution Approach 1:
The patent pre-compiles data structure access functions into shared library modules before query execution. By performing the compilation action in advance, the system eliminates the need to re-compile these functions during each query processing cycle, thus reducing the compilation time overhead while maintaining the performance benefits of generated code.
Solution Approach 2:
The patent segments the code generation process by separating query-specific code from data structure access functions. The data structure functions are compiled into independent shared library modules, while query code is generated to link against these pre-compiled modules. This segmentation allows query execution to benefit from optimized code generation without incurring the full compilation overhead.
2Adaptability or versatility
If data structure functions are included in generated code, then data structure manipulation capability is improved, but compile time increases significantly
Solution Approach 1:
The patent extracts data structure access functions from the query-specific generated code and places them into separate shared library modules. This extraction allows the query code to maintain full data structure manipulation capability through function calls, while avoiding the compilation overhead of including these functions directly in each generated query program.
Solution Approach 2:
The patent creates universal shared library modules that contain data structure access functions applicable to multiple different queries. These modules serve multiple purposes across different query executions, allowing the system to maintain versatile data structure manipulation capability without recompiling the same functions repeatedly for each query.
Data Source
AI summary
Disclosed embodiments include generating code from a database query and providing a framework to develop complex data structures and the functions that access those data structures outside of the generated code to access the complex data structures. These data structure functions can be precompiled in order to save compilation time at query runtime, and linked to the generated code in a way that the framework can still inline function calls and apply various optimizations on the linked code.


