Runtime Predicate Reordering for Query Plan Selectivity Shifts

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing database systems face inefficiencies in query execution due to static predicate ordering based on inaccurate cardinality estimations, leading to excessive resource utilization and suboptimal performance.

Innovation Solution

Dynamic predicate reordering at runtime based on actual data distribution statistics, using a heuristic to determine the optimal order of filter expressions, ensuring efficient resource use and performance improvements.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If static predicate ordering is used based on cardinality estimations, then query execution follows a predetermined plan, but performance is suboptimal due to inaccurate estimations and excessive resource utilization

Engineering Contradiction:
Improvequery execution efficiencyVSAvoidcomputing resource utilization
Core Design Contradiction:
ProductivityVSUse of energy by moving object

Solution Approach 1:

The patent implements dynamic predicate reordering at runtime by monitoring actual data distribution statistics and adjusting the evaluation order of filter expressions based on observed selectivity. Instead of using a static query plan determined at compilation time, the system dynamically adapts the predicate evaluation sequence during query execution to match actual data characteristics, thereby optimizing resource utilization and improving query performance

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system incorporates feedback mechanisms by collecting actual data distribution statistics during query execution and using this information to adjust predicate ordering. The query optimizer monitors runtime statistics such as selectivity of filter expressions and uses this feedback to dynamically reorder predicates, ensuring that the most selective filters are evaluated first based on actual rather than estimated data characteristics

Inventive Principle:
Principle #23Feedback

2Reliability

If predicate ordering is based on cardinality estimations, then query plans can be generated at compilation time, but performance degrades when actual data distribution differs from estimations

Engineering Contradiction:
Improvequery performance consistencyVSAvoidadaptation to changing data distributions
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The system transitions from static to dynamic predicate ordering by implementing runtime adjustment mechanisms. The query execution engine continuously monitors actual data distribution and dynamically reorders predicates based on observed statistics, ensuring consistent performance regardless of changes in data distribution between compilation and execution phases

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent changes the parameter used for predicate ordering from estimated cardinality values to actual runtime statistics. By switching from static cardinality estimates to dynamic observed selectivity measurements, the system adapts to changing data distributions and maintains reliable query performance across different data states

Inventive Principle:
Principle #35Parameter changes

3Productivity

If dynamic predicate reordering is implemented at runtime, then query execution efficiency improves, but system complexity increases

Engineering Contradiction:
Improvequery execution efficiencyVSAvoidsystem complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The system implements self-service by enabling the query execution engine to automatically adjust predicate ordering based on observed data statistics without requiring external intervention. The runtime optimizer autonomously collects statistics, evaluates selectivity, and reorders predicates, reducing the need for manual query tuning while improving execution efficiency

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The feedback mechanism collects actual data distribution statistics during query execution and uses this information to automatically adjust predicate ordering. This closed-loop approach balances the increased system complexity with tangible performance benefits, as the additional complexity enables adaptive optimization that directly improves query execution efficiency

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS20250371011A1Dynamic predicate reordering at runtime
Publication Date: 2025.12.04 SNOWFLAKE INC
  • US20250371011A1 patent drawing
  • US20250371011A1 patent drawing
  • US20250371011A1 patent drawing

AI summary

The subject technology receives a first query plan corresponding to a query, the first query plan comprising a set of predicates. The subject technology receives, during execution of a first portion of the first query plan, a set of rowsets. The subject technology determines a set of metrics for a first number of rows from a plurality of rows, the first number of rows corresponding to a first predicate order. The subject technology determines, using a heuristic, a second predicate order based at least in part on the set of metrics. The subject technology processes, during execution of the first portion of the first query plan using the second predicate order, a second set of rowsets, the second set of rowsets comprising a second plurality of rows that correspond to the first portion of the first query plan that has been executed based on the second predicate order.