Query Optimizer Lineage Recording for Plan Replay

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current database systems face significant processing resource consumption and exponential query optimization time due to the large search space of possible query execution plans, leading to inefficient query optimization and memory usage, especially when query plans need to be recomputed.

Innovation Solution

A query optimizer records the lineage of transformations used to generate a query execution plan, allowing for optimization replay by limiting the application of only those transformations that resulted in the original plan, thereby reducing the search space and optimizing resource consumption.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If query optimization explores all possible transformations to find optimal execution plans, then query execution plan quality is improved, but processing time and resource consumption increase exponentially

Engineering Contradiction:
Improvequery execution plan qualityVSAvoidquery optimization time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system performs preliminary recording of transformation lineage during the first query optimization process. This recorded lineage information is then utilized in subsequent query optimizations to guide the search process, eliminating the need to re-explore the entire transformation space and thereby reducing optimization time while maintaining plan quality.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system uses feedback from the recorded transformation lineage to inform and constrain subsequent query optimization processes. By feeding back the successful transformation paths from previous optimizations, the system can efficiently reproduce optimal plans without redundant exploration, directly addressing the time-quality tradeoff.

Inventive Principle:
Principle #23Feedback

2Adaptability or versatility

If query optimization applies all available transformations with multiple invocations, then the completeness of query execution plans is improved, but the set of possible combinations becomes very large consuming more memory

Engineering Contradiction:
Improvequery execution plan completenessVSAvoidnumber of possible combinations
Core Design Contradiction:
Adaptability or versatilityVSQuantity of substance

Solution Approach 1:

The system extracts and records only the essential transformation lineage information from the complete set of possible transformations. This extracted lineage data captures the critical paths without needing to maintain the entire exponential space of possible combinations, thereby reducing memory requirements while preserving plan completeness.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

Instead of maintaining the full original search space, the system creates a compressed representation (copy) of the transformation lineage. This lineage copy contains sufficient information to reconstruct optimal plans without replicating the entire exponential combination space, thus reducing memory consumption while preserving completeness.

Inventive Principle:
Principle #26Copying

3Speed

If query execution plans are cached to avoid reoptimization, then query processing speed is improved, but cache management complexity and replacement strategies increase

Engineering Contradiction:
Improvequery processing speedVSAvoidcache management complexity
Core Design Contradiction:
SpeedVSDevice complexity

Solution Approach 1:

The system enables self-service query optimization by using recorded lineage information to automatically guide subsequent optimizations. This self-service mechanism allows the optimizer to efficiently reproduce optimal plans without requiring complex cache management strategies, as the lineage data itself provides the guidance needed for rapid reoptimization when necessary.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS10872085B2Recording lineage in query optimization
Publication Date: 2020.12.22 MICROSOFT TECHNOLOGY LICENSING LLC
  • US10872085B2 patent drawing
  • US10872085B2 patent drawing
  • US10872085B2 patent drawing

AI summary

A database system includes a query optimizer which applies transformations to a logical representation of an input query in a declarative query language to generate expressions for a query execution plan. The query optimizer stores information, for each rule application, indicating a transformation applied and bindings for the transformation, the bindings indicating expressions input to the transformation. When a new query execution plan is to be generated for the input query, the query optimizer uses this stored information, for expressions in an original query execution plan, to guide the query optimizer to produce a current query execution plan while avoiding transformations not used to generate expressions in the original query execution plan.