Native Access Plan Generation for Dynamic Entity Binding
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Database systems using intermediate representation languages like LLVM, which are not object-oriented, lack support for dynamically-bound entities, hindering the implementation of dynamic query execution plans.
Innovation Solution
A database system generates a native access plan by converting query plans into intermediate representation code, utilizing LLVM JIT compiler to execute dynamic entity calls through indirect branch instructions and data structures that determine the proper entity implementation at runtime.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If database systems use intermediate representation languages like LLVM to implement query execution plans, then the systems can benefit from efficient code generation and execution, but the systems cannot support dynamically-bound entities because these languages are not object-oriented
Solution Approach 1:
The patent introduces a code generation module as an intermediary layer between the query optimizer and the LLVM compiler. This module translates the object-oriented query execution plans into LLVM intermediate representation code, enabling dynamic entity binding capabilities to be preserved while generating efficient LLVM code for execution. The intermediary translates virtual function calls and dynamic bindings into equivalent LLVM instructions.
Solution Approach 2:
The patent replaces the direct object-oriented execution model with a code-generation model that produces LLVM intermediate representation. Instead of executing query plans directly as object-oriented code, the system generates LLVM bytecode that can be JIT-compiled, substituting the mechanical execution model while preserving the logical query optimization capabilities.
2Speed
If database systems use non-object-oriented intermediate representation languages, then the systems can achieve better performance through optimized code generation, but the systems lose the ability to dynamically bind entities at runtime
Solution Approach 1:
The patent performs preliminary code generation at query optimization time, creating LLVM intermediate representation code that includes placeholders and indirect call structures for dynamic entities. The code generation module prepares the execution framework in advance, including setting up virtual function tables and indirect call mechanisms, so that runtime dynamic binding can occur efficiently within the LLVM execution model.
Solution Approach 2:
The patent introduces dynamic dispatch mechanisms into the LLVM code generation process. The generated LLVM code uses indirect function calls and runtime type information to enable dynamic entity binding, making the previously static LLVM execution model dynamic. This allows the system to resolve entities at runtime while maintaining the performance benefits of compiled code.
Data Source
AI summary
Disclosed herein are system, method, and computer program product embodiments for generating a native access plan from a query execution plan for dynamic entity calling. An embodiment operates by receiving the query execution plan comprising at least one call to an entity, the entity being implemented by a plurality of classes, and generating source code of a native access plan that implements the query execution plan. The source code of the native access plan includes instructions to translate a run-time call to the entity to a call to a corresponding implementation of the entity based on an identifier of the called implementation of the entity.


