Fine-Grained SQL Hints for Query Optimizer Error Handling
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Database systems face challenges in efficiently addressing errors during query compilation, leading to recurring inefficiencies and sub-optimal execution plans, as existing solutions often resort to draconian measures that disable advanced optimization features.
Innovation Solution
The implementation of fine-grained hints specifically targeted at specific query blocks and transformations within SQL queries, allowing for precise error prevention while maintaining optimal query performance by using SQL patches to steer the query optimizer away from erroneous code paths.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If advanced optimization options are completely removed to ensure error resolution, then error recurrence is prevented, but query execution efficiency deteriorates
Solution Approach 1:
The patent segments the optimization options into individual transformable objects (TFOs) that can be independently controlled. Instead of removing all advanced optimization options, the system identifies and disables only the specific TFO associated with the error, while preserving other optimization capabilities. This segmentation allows selective error handling without sacrificing overall query performance.
Solution Approach 2:
The patent applies local quality by making optimization control granular at the TFO level rather than globally. Each TFO can be independently enabled or disabled based on error occurrence, allowing the system to maintain high optimization quality in unaffected areas while locally adjusting for error-prone transformations. This ensures that only the necessary optimization features are restricted.
2Reliability
If compilation cycles are repeated without adequate error addressing, then compilation completeness is maintained, but time consumption increases
Solution Approach 1:
The patent implements preliminary action by proactively disabling the specific TFO that caused the error before subsequent compilation cycles attempt the same transformation. The system learns from the error, identifies the problematic TFO, and prevents its reapplication in future compilations. This preliminary prevention eliminates recurring errors and avoids wasteful repeated compilation attempts.
Solution Approach 2:
The patent incorporates feedback mechanisms where compilation errors are captured and analyzed to identify the specific TFO responsible. This feedback loop enables the system to adjust optimization settings dynamically, disabling only the problematic transformation while maintaining other optimizations. The feedback ensures that compilation completeness is preserved by learning from errors rather than repeating them.
Data Source
AI summary
Disclosed is an approach for applying fine-grained hints to obtain optimal control over error handling during query compilation. Using fine-grained hints causes less disruption to the query plans generated by the optimizer as they constrain specific features while retaining scope for the rest of the optimizer functionality. This approach provides a query plan of better quality that avoid errors, particularly in comparison to coarse-grained approaches that restrict processing to earlier database versions or which disables cost-based processing.


