JIT Query Execution Infrastructure for Database Performance

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Interpretive approaches to database queries introduce execution overhead due to expensive virtual function calls and unnecessary CPU cycles, which can be improved by combining just-in-time compilation with block-wise query execution.

Innovation Solution

Implementing a JIT query execution infrastructure that uses an LLVM compiler framework to generate optimized native machine code for query plan fragments, caching compiled objects for reuse, and normalizing function nodes into string keys for efficient retrieval and compilation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of manufacture

If interpretive approach is used for query execution, then ease of implementation is improved, but execution overhead increases

Engineering Contradiction:
Improveease of implementationVSAvoidexecution overhead
Core Design Contradiction:
Ease of manufactureVSLoss of time

Solution Approach 1:

The system performs preliminary compilation of query execution plans into native machine code before actual query execution. The query optimizer generates an execution plan that is then compiled by a JIT compiler into optimized native code, which is cached and executed directly. This preliminary compilation action eliminates the need for repeated interpretation during query execution, thereby reducing execution overhead while maintaining implementation feasibility.

Inventive Principle:
Principle #10Preliminary action

2Speed

If JIT compilation is implemented for query execution, then execution speed is improved, but system complexity increases

Engineering Contradiction:
Improveexecution speedVSAvoidsystem complexity
Core Design Contradiction:
SpeedVSDevice complexity

Solution Approach 1:

The system introduces an intermediary JIT compilation layer between the query optimizer and the execution engine. The query optimizer generates execution plans in an intermediate representation, which is then passed to the JIT compiler that translates it into native machine code. This intermediary compilation step enables execution speed improvement by producing optimized native code, while the modular architecture of the intermediary layer helps manage system complexity through clear separation of concerns.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The query execution system is segmented into distinct modular components: query parser, query optimizer, JIT compiler, and execution engine. Each component handles a specific aspect of query processing independently. The JIT compiler is further segmented to handle different types of execution plans and generate specialized native code for each. This segmentation allows the system to achieve high execution speed through targeted optimization while managing complexity through modular design.

Inventive Principle:
Principle #1Segmentation

3Productivity

If query-specific compilation is performed, then query execution performance is improved, but compilation time increases

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

Solution Approach 1:

The system performs preliminary compilation of query execution plans into native machine code before actual query execution. The query optimizer generates an execution plan that is then compiled by a JIT compiler into optimized native code, which is cached and executed directly. This preliminary compilation action eliminates the need for repeated interpretation during query execution, thereby reducing execution overhead while maintaining implementation feasibility.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system creates and caches compiled execution plans as reusable templates for similar queries. When a query execution plan is compiled into native machine code, the resulting compiled object is stored in a cache. Subsequent queries with similar execution plans can reuse these cached compiled objects, avoiding redundant compilation and reducing overall compilation time while maintaining high query execution performance.

Inventive Principle:
Principle #26Copying

Data Source

PatentEP3341865B1System and method for database query
Publication Date: 2020.08.26 HUAWEI TECH CO LTD
  • EP3341865B1 patent drawingFigure 1~3
  • EP3341865B1 patent drawingFigure 2
  • EP3341865B1 patent drawingFigure 4~5

AI summary

A method includes receiving, by a database system, a query statement and forming a runtime plan tree in accordance with the query statement. The method also includes traversing the runtime plan tree including determining whether a function node of the runtime plan tree is qualified for just-in-time (JIT) compilation. Additionally, the method includes, upon determining that the function node is a qualified for JIT compilation producing a string key in accordance with a function of the function node and determining whether a compiled object corresponding to the string key is stored in a compiled object cache.