Dynamic Query Plan Interpretation Using Compiled Executors

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Database systems face performance issues due to high compilation times for query execution, especially when queries are new or vary significantly, leading to increased complexity and costs, and cached compiled code may not be usable for different queries, resulting in initial queries suffering from compilation time penalties.

Innovation Solution

Implementing dynamic plan interpretation using a domain-specific language that leverages previously compiled executors to perform query operations, allowing for sub-second query execution times without compilation, and pre-warming code object caches to avoid initial compilation penalties, while moving the compiler out of the query performance path to enable faster code generation and reduce dependence on compiler upgrades.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If code generation and compilation is used to perform query operations, then query execution performance is improved, but compilation time increases query runtime and initial queries suffer from compilation time penalties

Engineering Contradiction:
Improvequery execution performanceVSAvoidcompilation time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The system performs preliminary code generation and compilation in advance, storing compiled code in a code store. When a query is received, the system checks the code store for pre-compiled code that can be reused, avoiding compilation time penalties for initial queries and improving overall query execution performance.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system creates and stores compiled code objects in a code store after initial compilation. Subsequent queries can copy and reuse these pre-compiled code objects instead of recompiling, eliminating redundant compilation time while maintaining optimized query execution performance.

Inventive Principle:
Principle #26Copying

2Quantity of substance

If database systems store and manage increasing amounts of data, then data capacity is improved, but complexity and cost of maintaining data increases

Engineering Contradiction:
Improvedata capacityVSAvoidsystem complexity
Core Design Contradiction:
Quantity of substanceVSDevice complexity

Solution Approach 1:

The system extracts the code generation and compilation process from the main query execution path, placing it in a separate code store. This separation allows the query execution engine to operate independently with reduced complexity, while the code store handles the complex compilation tasks, enabling the system to manage larger data volumes without proportionally increasing operational complexity.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

By pre-generating and storing compiled code objects, the system prepares optimization work in advance. This preliminary action reduces the real-time complexity of query execution, allowing the database to handle increased data capacity without linearly increasing the complexity of data maintenance operations.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS12169491B1Dynamic selection of plan interpretation to perform queries
Publication Date: 2024.12.17 AMAZON TECH INC
  • US12169491B1 patent drawing
  • US12169491B1 patent drawing
  • US12169491B1 patent drawing

AI summary

Dynamic plan interpretation may be implemented to perform queries. A query is received at a database system. A plan to perform the query is generated. For at least a portion of the plan to perform the query, a domain-specific language may be applied to interpret and execute the portion of the plan to perform the query using one or more previously compiled executors instead of generating and compiling code to execute the portion of the plan. Returning a result of the query according to the execution of the plan.