Dynamic Query Plan Reordering for Database Efficiency

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Query execution plans in database systems can be inefficient due to incorrect estimates of intermediate query results and design errors, leading to computational inefficiencies and human errors in manual planning, while automated methods may also generate suboptimal plans.

Innovation Solution

Dynamic re-sequencing of operations in query execution plans based on shared sort orders and policies that optimize the execution order of join and aggregation operations, allowing for improved efficiency and workload management without wasted effort, including pause and resume functionality.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If the query execution plan is generated using traditional optimization techniques, then the plan can be created based on current database state, but the plan may include inefficiencies due to dynamic database state variations between optimization and execution

Engineering Contradiction:
Improveaccuracy of intermediate query result estimatesVSAvoidquery execution efficiency
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The system dynamically re-sequences operations in the query execution plan during runtime based on actual database state and intermediate result characteristics, rather than relying solely on static optimizer estimates. This allows the execution plan to adapt to dynamic database state changes between optimization and execution phases.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system monitors intermediate query results during execution and uses this feedback to dynamically adjust the sequencing of operations. When intermediate results exhibit certain characteristics (e.g., sorted data), the system feedback-triggered re-sequencing to optimize subsequent operations like joins and aggregations.

Inventive Principle:
Principle #23Feedback

2Productivity

If operations are executed strictly in the sequence specified by the query plan, then the plan structure is maintained, but computational inefficiencies occur when intermediate results have shared sort orders that could be exploited

Engineering Contradiction:
Improvequery execution speedVSAvoidcomplexity of execution control logic
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The execution engine dynamically determines the sequencing of operations based on runtime conditions such as shared sort orders in intermediate results. This dynamic approach allows the system to exploit optimization opportunities without requiring complex static plan transformations.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system changes the execution parameter (operation sequence) based on detected characteristics of intermediate results. When shared sort orders are detected, the system adjusts the execution sequence to leverage this property, thereby improving join and aggregation performance without fundamental changes to the query plan structure.

Inventive Principle:
Principle #35Parameter changes

3Reliability

If the query execution plan is optimized for initial database state, then the plan works correctly for that state, but it may become suboptimal when database state changes during execution

Engineering Contradiction:
Improvecorrectness of query resultsVSAvoidquery execution efficiency
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The system maintains reliability by preserving the logical correctness of the query plan while dynamically adjusting the physical execution sequence. The re-sequencing operates within the constraints of the original plan's data flow requirements, ensuring correctness while adapting to runtime conditions for improved efficiency.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system performs preliminary analysis of intermediate results during execution to identify opportunities for optimization. By detecting shared sort orders early in the execution process, the system can prepare and apply optimized sequencing strategies before executing costly operations like joins and aggregations.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS9594804B2Dynamic reordering of operations in a query plan
Publication Date: 2017.03.14 HEWLETT PACKARD ENTERPRISE DEV LP
  • US9594804B2 patent drawing
  • US9594804B2 patent drawing
  • US9594804B2 patent drawing

AI summary

There is provided a computer-implemented method of dynamically reordering operations in a query plan. An exemplary method comprises processing a first set of tuples according to a first operation. The query plan is pipelined and specifies that the first operation generates input for a second operation. The query plan further specifies that the second operation is executed after the first operation. The computer-implemented method further includes determining that the second operation is to precede the first operation based on a specified policy. The computer-implemented method further includes executing the second operation for a second set of tuples before executing the first operation for the second set of tuples. The second operation generates an input for the first operation. The first operation is executed after the second operation.