Query Block Identifier Specification for SQL Optimization
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In complex SQL statements, it is challenging to specify optimizer hints for join order and method, especially when tables appear at multiple levels of select and subselect clauses, and it is difficult to use query hints to change the optimizer plan generation, particularly when the SQL generator is not accessible.
Innovation Solution
The system receives a query block with a hint that includes an object identifier based on an unambiguous numbering scheme, allowing hints to be applied to nested query blocks and specifying the object to which the hint applies, enabling the optimization of query execution plans even when direct access to the query generator is not available.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If optimizer hints are used to guide query execution plan selection, then query performance is improved, but it becomes difficult to specify hints in large complex SQL statements with multiple select and subselect clauses
Solution Approach 1:
The patent segments the complex SQL query into multiple query blocks, each assigned a unique query block identifier (QBI). Hints are then associated with specific query blocks using these identifiers, allowing precise control over execution plans for different segments of the query without affecting the entire complex statement.
Solution Approach 2:
The patent introduces query block identifiers as an intermediary mechanism between the SQL generator and the query optimizer. These identifiers act as mediators that enable hint specification without requiring direct access to or modification of the original SQL statement structure, thus simplifying the process of guiding optimization in complex queries.
2Productivity
If query hints are applied to optimize execution plans, then query performance improves, but it is difficult to apply hints when the SQL generator is not accessible
Solution Approach 1:
The patent introduces query block identifiers as an intermediary mechanism between the SQL generator and the query optimizer. These identifiers act as mediators that enable hint specification without requiring direct access to or modification of the original SQL statement structure, thus simplifying the process of guiding optimization in complex queries.
Solution Approach 2:
The patent creates a logical copy of the query structure by assigning identifiers to query blocks. This allows the hint specification system to work with a simplified representation of the query rather than requiring direct manipulation of the original SQL, making it applicable even when the SQL generator is not accessible.
3Productivity
If traditional hint specification methods are used, then simple queries can be optimized, but complex SQL statements with tables at multiple levels cannot be properly optimized
Solution Approach 1:
The patent segments the complex SQL query into multiple query blocks, each assigned a unique query block identifier (QBI). Hints are then associated with specific query blocks using these identifiers, allowing precise control over execution plans for different segments of the query without affecting the entire complex statement.
Solution Approach 2:
The patent adds a new dimension to hint specification by introducing query block identifiers that operate at the query block level rather than just the table or column level. This additional dimension enables precise targeting of hints to specific portions of complex queries, managing complexity through hierarchical organization.
Data Source
AI summary
A query optimizer may receive a query (e.g., from a source that generated the query). Input that specifies both a query hint string and a hint may be received to a hint specification interface. The hint may be applied to the query, from outside the query, to optimize a query execution plan. Applying the hint may be based, at least in part, on a query hint string. For example, which query block is associated with the query hint string may be determined. Upon such a determination, the hint may be applied to the determined query block.


