Query Plan Generation for Precompiled and Code Generating Operations
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Database management systems face challenges in optimizing performance for complex and voluminous queries, as pushing complex operations to the application layer increases complexity, while pushing them to the database layer can reduce performance and response times.
Innovation Solution
A method that translates query operations into corresponding code, determining the context for translation as either code-generating or pre-compiled, and inserting adaptor code to decompose or recompose data chunks, allowing for a mixed execution model that optimizes query plans by combining pre-compiled and code-generating query operations.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If complex query operations are pushed to the application layer, then the database layer performance is improved, but the application layer complexity increases
Solution Approach 1:
The patent introduces an execution engine as an intermediary layer between the application layer and database layer. This execution engine translates query operations into code and manages the coordination between different layers, thereby reducing the complexity burden from the application layer while maintaining improved database performance.
Solution Approach 2:
The patent segments the query execution process into distinct components: query operations, code generation, execution plans, and data chunk processing. By dividing the complex query operations into manageable segments that can be independently translated and executed, the system reduces overall complexity while preserving performance benefits.
2Productivity
If query operations are translated into code with adaptor code insertion, then query execution efficiency is improved, but code generation complexity increases
Solution Approach 1:
The patent applies preliminary action by pre-compiling frequently used query operations into code templates. The execution engine translates query operations into corresponding code in advance, and inserts adaptor code between code for query operations and code for previous query operations when context changes are detected. This preliminary code generation improves query execution efficiency while managing complexity through systematic translation rules.
3Adaptability or versatility
If a mixed execution model is used with both pre-compiled and code-generating query operations, then adaptability is improved, but system complexity increases
Solution Approach 1:
The patent implements a dynamic execution model that can adaptively switch between pre-compiled and code-generating query operations based on the specific query context. The execution engine determines the appropriate execution mode for each query operation, allowing the system to optimize for both speed and flexibility without requiring a single complex fixed architecture.
Data Source
AI summary
A system for generating a query plan is provided. In some implementations, the system performs operations comprising: translating, into corresponding code, a query operation in a query plan comprising a sequence of query operations; determining a context for the translating of the query operation, the context corresponding to whether the query operation comprises a pre-compiled query operation or a code-generating query operation; and inserting adaptor code between code for the query operation and code for one or more previous query operations in the sequence of query operations, when a change in context is detected between the translating of the query operation and a translation of the one or more previous query operations. Related methods and articles of manufacture are also described.


