Multi-View Query Parse Tree Optimization for Redundant Depth Checks
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing database query execution with multiple SQL views is inefficient due to redundant maximum depth checks, leading to time-consuming processes that reduce performance.
Innovation Solution
A method to optimize database queries with multiple views by generating a parse tree, traversing it to identify views, and performing view unfolding, attaching subtrees, and skipping redundant depth checks until the last view is reached, followed by a single maximum tree depth check.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If maximum depth check is performed multiple times for each view in a query with multiple views, then query correctness is ensured, but query execution performance deteriorates
Solution Approach 1:
The patent performs the maximum depth check only once at the beginning of query execution, before processing multiple views. This preliminary check establishes the depth limit threshold that will be applied throughout subsequent view processing, eliminating the need for repeated checks while maintaining query correctness
Solution Approach 2:
The patent creates a global parse tree that serves multiple purposes: it represents the entire query structure containing multiple views, and simultaneously provides a single point for depth validation. This universal structure allows one depth check to validate the entire query rather than requiring separate checks for each view
2Reliability
If maximum depth check is performed multiple times for each view in a query with multiple views, then query validation is thorough, but execution time increases
Solution Approach 1:
The maximum depth check is performed once at the beginning of query execution, establishing the depth limit threshold before processing multiple views. This preliminary validation ensures query correctness while minimizing execution time by avoiding redundant checks
Solution Approach 2:
The patent merges multiple view processing into a single global parse tree structure, allowing one depth check to validate the entire query. By combining validation into a single operation rather than separate checks for each view, execution time is reduced while maintaining thorough validation
Data Source
AI summary
Arrangements for optimization of database queries having multiple views are provided. A query defining multiple views may be received. A parse tree may be generated based on the query. The query may be preprocessed using the parse tree. The parse tree may be traversed to identify the multiple views. View unfolding may be executed to generate a view subtree. The view subtree may be attached to the parse tree and a view query compile tree may be generated. It may be determined whether there is another view defined by the query. In response to determining that there is not another view, the parse tree may be traversed to calculate tree depth. In response to determining that there is another view defined by the query, calculation of the tree depth may be skipped.


