Database User-Defined Extension Compilation via Placeholder Binding
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Database management systems face inefficiencies due to the significant computational time spent on compiling and generating executable code for each query or function, leading to poor performance as they spend more resources on code compilation than execution.
Innovation Solution
A method involving a two-pass approach where user-defined extensions are first bound to placeholder objects and then compiled into machine code, allowing for delayed evaluation and efficient reuse of compiled code, reducing the need for repeated compilation.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a compiler is used to generate executable code for each query or function, then the system can execute queries accurately, but the compilation time and computational resources increase significantly
Solution Approach 1:
The patent pre-compiles query templates and function definitions into executable code before they are actually needed for query execution. This preliminary compilation action stores the executable code in memory, so when the same query or function is executed again, the system can directly use the pre-compiled code without repeating the compilation process, thus reducing compilation time while maintaining execution accuracy
Solution Approach 2:
The patent creates universal query templates that can represent multiple specific queries with the same structure. By compiling these universal templates once, the system can serve multiple specific query instances, reducing redundant compilation efforts while maintaining the ability to execute diverse queries accurately
2Adaptability or versatility
If each query or function is interpreted and compiled independently, then the system can handle diverse queries, but the cumulative compilation overhead increases substantially
Solution Approach 1:
The patent segments queries into template portions and specific parameter portions. The template portions that define the query structure are compiled once into universal executable code, while only the specific parameters need to be substituted at runtime. This segmentation allows the system to handle diverse queries by reusing compiled template code rather than compiling each complete query independently
Solution Approach 2:
The patent creates copies of compiled query template code and stores them in a cache or memory for rapid retrieval. When a new query matches an existing template structure, the system copies the pre-compiled code rather than recompiling, significantly reducing compilation overhead while maintaining the ability to handle diverse query types
Data Source
AI summary
A method includes receiving a user-defined extension configured to operate on data from a content database and comprising code expressed in a first programming language, the user-defined extension comprising at least one unresolved object and a function calling the at least one unresolved object. On a first pass through the user-defined extension code, each respective unresolved object is bound to a respective placeholder object such that the function calls each respective placeholder object and each respective placeholder object is mapped to the respective unresolved object, and delaying evaluation of the user-defined extension code until a second pass through the user-defined extension code. On the second pass, machine code corresponding to a compiled version of the user-defined extension is obtained by sequentially obtaining machine code for each respective unresolved object as each respective placeholder is called in the function. A related system and non-transitory computer-readable medium are also provided.


