Decorrelating Lateral Views for Query Optimization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Database query optimization is hindered by the computational expense of evaluating complex join predicates in lateral views, which limits the choice of join methods and access paths, particularly due to the reliance on computationally expensive nested-loop joins.

Innovation Solution

Transforming queries by removing correlated predicates from lateral views to create de-correlated views, allowing for a wider range of join methods and access paths, including hash joins and sort-merge joins, and moving predicates to the WHERE clause to preserve semantic equivalence.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If correlated predicates are evaluated in lateral views, then query correctness is ensured, but computational overhead increases and join method choices are limited

Engineering Contradiction:
Improvequery correctnessVSAvoidcomputational overhead
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The patent extracts correlated predicates from the lateral view definition and moves them to the outer query's WHERE clause. This separation allows the lateral view to be evaluated independently without the computational burden of correlated subqueries, reducing overhead while preserving the original query's semantic meaning and correctness through the outer query's filter conditions.

Inventive Principle:
Principle #2Taking out (Extraction)

2Reliability

If correlated predicates are evaluated in lateral views, then query semantics are preserved, but join method options are restricted to nested-loop joins

Engineering Contradiction:
Improvequery semanticsVSAvoidjoin method choices
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

By extracting correlated predicates from the lateral view and placing them in the outer query's WHERE clause, the patent removes the restriction that forced nested-loop join evaluation. The lateral view can now be evaluated using more efficient join methods (hash join, sort-merge join) independently, while the outer query maintains the original semantic requirements through its filter conditions.

Inventive Principle:
Principle #2Taking out (Extraction)

3Measurement precision

If complex join predicates are evaluated in lateral views, then query accuracy is maintained, but query execution performance deteriorates

Engineering Contradiction:
Improvequery accuracyVSAvoidquery execution performance
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The patent extracts complex join predicates from the lateral view definition and relocates them to the outer query's WHERE clause. This allows the lateral view to be evaluated once using efficient join methods without repeated predicate evaluation for each outer row, significantly improving execution performance while the outer query's WHERE clause ensures the original accuracy requirements are met.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

By evaluating the lateral view independently before the outer query execution, the patent performs the computationally expensive join operation in advance. The extracted predicates are then applied as simple filters in the outer query, avoiding the need to re-evaluate complex conditions for each row combination and thereby improving overall query execution performance.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS8548983B1Technique of decorrelation of lateral views
Publication Date: 2013.10.01 ORACLE INT CORP
  • US8548983B1 patent drawing
  • US8548983B1 patent drawing
  • US8548983B1 patent drawing

AI summary

Methods, computer-readable media, and machines are provided for transforming a query by removing a correlated predicate from a lateral view in an initial query. A query processor may transform the lateral view into a regular view such that a transformed query with the regular view is semantically equivalent to the initial query. The transformed query may support a larger set of access paths, join methods, and join permutations, may qualify for other transformations or optimizations, or may otherwise be executed or optimized differently from the initial query. The lateral view may reference an aggregation function, and the query processor may add a GROUP BY operator to the transformed query to preserve, after the correlated predicate has been pulled out of the lateral view, an interaction that was present between the aggregation function and the correlated predicate when the correlated predicate was in the lateral view.