Worst-Case Predicate Selectivity for Adaptive Query Plans

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing database query optimization methods struggle with performance degradation due to skewed data distributions, particularly when using worst-case compile-time selectivity estimates, leading to inefficient query execution plans.

Innovation Solution

A combined approach of compile-time worst-case selectivity estimation and runtime adaptation is employed to determine the order of predicate evaluation, using worst-case selectivity estimates to optimize query plans and adaptively modify them based on actual parameter values at runtime, thereby improving query performance and resource usage.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If worst-case compile-time selectivity estimates are used to determine predicate evaluation order, then query plans are optimized for worst-case scenarios, but query performance degrades when actual data distributions differ from worst-case estimates

Engineering Contradiction:
Improvequery plan robustnessVSAvoidquery execution performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The system dynamically adapts the query execution plan by switching from a static worst-case predicate evaluation order to a runtime-determined order based on actual parameter values. The query optimizer evaluates predicates in an optimal order at runtime using actual parameter bindings, rather than relying on compile-time worst-case estimates, thereby achieving both robustness and performance.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system changes the selectivity parameter from fixed worst-case compile-time estimates to dynamic runtime estimates based on actual parameter values. By using actual parameter bindings at runtime to determine predicate selectivity, the system adapts to the real data distribution and achieves optimal query execution performance while maintaining reliability through adaptive plan selection.

Inventive Principle:
Principle #35Parameter changes

2Productivity

If query plans are optimized based on initial parameter values, then execution is efficient for those specific parameters, but performance degrades when actual parameter values differ from initial estimates

Engineering Contradiction:
Improvequery execution efficiencyVSAvoidquery plan adaptability
Core Design Contradiction:
ProductivityVSAdaptability or versatility

Solution Approach 1:

The system transitions from static query plan optimization based on initial parameter guesses to dynamic optimization using actual runtime parameter values. The predicate evaluation order is determined at runtime based on actual parameter bindings, allowing the system to adapt to different parameter values and maintain high execution efficiency across various query scenarios.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system uses actual runtime parameter values as feedback to determine the optimal predicate evaluation order. Instead of relying on initial parameter estimates, the query optimizer receives actual parameter bindings during query execution and uses this feedback to dynamically select the most efficient execution plan, thereby achieving both efficiency and adaptability.

Inventive Principle:
Principle #23Feedback

3Loss of time

If predicate evaluation order is determined using estimated selectivity from initial parameters, then query plans are generated quickly, but execution performance suffers when actual parameter values create skewed data distributions

Engineering Contradiction:
Improvequery plan compilation timeVSAvoidquery execution performance
Core Design Contradiction:
Loss of timeVSProductivity

Solution Approach 1:

The system dynamically determines predicate evaluation order at runtime based on actual parameter values rather than using static compile-time estimates. This dynamic approach eliminates the performance degradation caused by skewed data distributions while maintaining efficient query execution, as the optimal evaluation order is selected based on actual runtime conditions.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system performs preliminary worst-case selectivity analysis at compile time to establish a baseline query plan, then adapts this plan at runtime using actual parameter values. This two-stage approach maintains fast query plan compilation while ensuring optimal execution performance by adjusting the predicate evaluation order based on actual runtime parameters.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS12386834B1Using worst-case predicate selectivity for database query plans
Publication Date: 2025.08.12 SAP SE
  • US12386834B1 patent drawing
  • US12386834B1 patent drawing
  • US12386834B1 patent drawing

AI summary

The present disclosure involves systems, software, and computer implemented methods for using worst-case predicate selectivity for database query plans. One example method includes identifying a query that includes an initial set of parameter values for a set of predicates. An order of predicate evaluation is determined for a query plan by determining a worst-case selectivity for each predicate and ordering the predicates based on the worst-case selectivities. A second instance of the query is received that includes a second set of parameter values. The second instance of the query is executed, to generate a query result, using the query plan and the second set of parameters by evaluating the set of predicates based on the second set of parameters and the order of predicate evaluation determined based on the worst-case selectivities. The query result is provided in response to the second instance of the query.