Query JIT Compilation Using Per-Operator Cardinality Thresholds

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional database compilation strategies lack granular execution strategies, applying the same compilation policies to all operators, leading to inefficient utilization of resources and suboptimal performance.

Innovation Solution

Adaptive just-in-time compiling based on per-operator cardinality estimates, allowing for tailored compilation decisions, including asynchronous compilation and mode switching between interpreted and compiled code based on workload thresholds.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Device complexity

If global compilation configurations are applied to all operators, then system simplicity is maintained, but resource utilization efficiency deteriorates

Engineering Contradiction:
Improvecompilation configuration complexityVSAvoidresource utilization efficiency
Core Design Contradiction:
Device complexityVSProductivity

Solution Approach 1:

The patent segments the global compilation configuration into per-operator level decisions by introducing cardinality estimates for each operator. This allows the system to evaluate and select compilation strategies individually for each operator based on its specific cardinality characteristics, thereby improving resource utilization efficiency while maintaining manageable complexity through automated estimation.

Inventive Principle:
Principle #1Segmentation

2Productivity

If per-operator compilation decisions are made, then resource utilization efficiency is improved, but compilation decision complexity increases

Engineering Contradiction:
Improveresource utilization efficiencyVSAvoidcompilation decision complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The system employs self-service by using the optimizer to automatically generate and provide cardinality estimates for each operator. These estimates enable the execution engine to autonomously make compilation decisions without requiring complex manual configuration or analysis, thus improving resource utilization while keeping the decision-making process manageable through automated estimation.

Inventive Principle:
Principle #25Self-service

3Speed

If compilation is performed synchronously, then execution speed is improved, but processing time increases due to compilation overhead

Engineering Contradiction:
Improveexecution speedVSAvoidcompilation time
Core Design Contradiction:
SpeedVSLoss of time

Solution Approach 1:

The patent applies preliminary action by initiating compilation processes in advance or during query planning phases rather than during execution. The system uses cardinality estimates to determine when compilation should be performed, allowing compiled code to be ready before query execution begins, thereby reducing runtime compilation overhead and improving execution speed.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system dynamically adjusts compilation strategies based on runtime conditions and cardinality estimates. It can switch between synchronous and asynchronous compilation modes, or between interpreted and compiled execution, depending on the operator's characteristics and current workload, thus optimizing the balance between execution speed and compilation time.

Inventive Principle:
Principle #15Dynamics

4Ease of operation

If interpreted mode is used for all operators, then processing flexibility is maintained, but execution speed deteriorates

Engineering Contradiction:
Improveprocessing flexibilityVSAvoidexecution speed
Core Design Contradiction:
Ease of operationVSSpeed

Solution Approach 1:

The patent applies local quality by selecting different execution modes (interpreted or compiled) for different operators based on their specific cardinality characteristics. Operators with high cardinality estimates can be executed in compiled mode for speed, while operators with low cardinality or uncertain characteristics can use interpreted mode for flexibility, thus optimizing both execution speed and processing flexibility at the local operator level.

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS20250390290A1Estimation based just-in-time compiling
Publication Date: 2025.12.25 SAP SE
  • US20250390290A1 patent drawing
  • US20250390290A1 patent drawing
  • US20250390290A1 patent drawing

AI summary

Arrangements for estimation based just-in-time compiling are provided. First and second thresholds may be set by selecting a value of a corresponding cardinality flag. One or more cardinality estimates may be received for each operator of a query, including input, output, and intermediate estimated cardinalities. For each operator, a highest value of the one or more cardinality estimates may be determined. Based on the highest value being less than or equal to the first threshold, the query may be processed initially by an interpreter and subsequently by a compiler. Based on the highest value being between the first and second thresholds, the query may be processed by both by the compiler and the interpreter at the start. Based on the highest value being greater than or equal to the second threshold, the query may be processed initially by the compiler and use of the interpreter may be avoided.