Query Plan Native Code Compilation for Database Execution Speed

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Traditional query processors use inefficient interpreter-based execution strategies for database queries, leading to slow processing times due to the need for static code interpretation and lack of native machine code execution.

Innovation Solution

Converting query plans into native machine code using a compiler backend and programmatic control flow, such as labels and goto statements, to instantiate code templates that perform the functionality of operators with specific operational parameters, thereby bypassing intermediate steps and optimizing execution.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If interpreter-based execution strategies are used for query processing, then language compatibility and ease of operation are maintained, but execution speed and productivity deteriorate

Engineering Contradiction:
Improvelanguage compatibilityVSAvoidexecution speed
Core Design Contradiction:
Ease of operationVSProductivity

Solution Approach 1:

The patent creates native code copies of query execution plans. Instead of interpreting SQL queries directly, the system compiles query plans into native machine code that can be executed directly by the processor, eliminating the interpretation overhead while preserving the high-level query language interface for users

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The patent replaces the mechanical interpretation process with a compilation and direct execution model. The interpreter-based mechanical execution of instructions is substituted by compiling query plans into native code that the processor can execute directly, significantly improving execution speed

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

2Productivity

If native code compilation is used for query execution, then execution speed improves, but device complexity and manufacturing precision requirements increase

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

Solution Approach 1:

The patent segments the query processing system into distinct components: query parsing, query optimization, code generation, and execution. Each component handles a specific aspect of query processing, allowing the complex task of query execution to be divided into manageable segments that can be optimized independently

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs query compilation and code generation in advance, before actual query execution. Query plans are compiled into native code templates that are stored and reused, eliminating the need for repeated compilation and interpretation during query execution, thus reducing runtime complexity

Inventive Principle:
Principle #10Preliminary action

3Productivity

If query plans are converted to native code templates, then execution efficiency improves, but code generation complexity and time increase

Engineering Contradiction:
Improveexecution efficiencyVSAvoidcode generation time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The patent performs query compilation and native code generation in advance, before actual query execution. Query plans are compiled into native code templates that are stored and reused, eliminating the need for repeated compilation and interpretation during query execution

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent creates universal code templates that can handle multiple similar query operations. Once a query plan is compiled into native code, the resulting template can be reused for executing similar queries, amortizing the code generation time across multiple executions and improving overall efficiency

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentUS9767147B2Method of converting query plans to native code
Publication Date: 2017.09.19 MICROSOFT TECHNOLOGY LICENSING LLC
  • US9767147B2 patent drawing
  • US9767147B2 patent drawing
  • US9767147B2 patent drawing

AI summary

Performing database queries. A method includes receiving a particular database query. The method further includes accessing a query plan based on the particular database query. The query plan has operators and specific operational parameters associated with each of the operators. The association of operators and specific operational parameters is specific to the particular database query. From the query plan, the method further includes instantiating a plurality of compiled code templates. Each code template includes executable code that when executed performs functionality of one of the operators from the query plan with the specific operational parameters applied in the compilation. The method further includes binding the code templates together using programmatic control flow to create a functioning program.