SQL Query Optimizer Analytical Function Join Execution

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Optimizing the execution order between analytical functions (AFs) and joins in SQL queries is challenging due to the complexity and cost uncertainty of AFs, which are often treated as black boxes, and the involvement of external engines leading to high data transfer and network overheads.

Innovation Solution

A method that determines AF properties such as 'surplus', 'rowIndependence', and 'partitionIndependence' to infer query-level properties, allowing for re-writing the query to either push or pull join operations within the AF, thereby optimizing the execution order and reducing data transfer and resource utilization.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If analytical functions are integrated within SQL queries, then query functionality is enhanced, but query optimization becomes difficult due to black box nature and unknown costs

Engineering Contradiction:
Improvequery functionalityVSAvoidquery optimization complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent changes the parameters of analytical functions by defining specific properties (rowIndependence, partitionIndependence, surplus) that transform the black box functions into optimizable operations. This allows the query optimizer to make informed decisions about execution order and join placement based on these defined parameters.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The patent segments the analytical function execution by identifying independent rows and partitions, allowing the join operation to be pushed into specific independent segments where it can be executed efficiently without affecting other segments.

Inventive Principle:
Principle #1Segmentation

2Adaptability or versatility

If analytical functions are provided by external engines, then functionality is extended, but data transfer and network overhead increase

Engineering Contradiction:
ImprovefunctionalityVSAvoiddata transfer overhead
Core Design Contradiction:
Adaptability or versatilityVSLoss of energy

Solution Approach 1:

The patent performs preliminary actions by pushing join operations into the analytical function execution plan before data is transferred to external engines. This preprocessing reduces the volume of data that needs to be transferred over the network by filtering and joining data locally first.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent extracts the join operation from the external engine execution context and places it in the database system's execution context, separating the join operation from the analytical function execution to reduce data transfer requirements.

Inventive Principle:
Principle #2Taking out (Extraction)

3Loss of energy

If join operations are performed before analytical functions, then data transfer is reduced, but execution order optimization is lost

Engineering Contradiction:
Improvedata transferVSAvoidquery execution efficiency
Core Design Contradiction:
Loss of energyVSProductivity

Solution Approach 1:

The patent makes the execution order dynamic by using the defined analytical function properties to determine the optimal execution order. The system can adaptively decide whether to push joins into AFs or execute them before AFs based on the specific properties of each function, rather than following a fixed execution order.

Inventive Principle:
Principle #15Dynamics

4Loss of energy

If join operations are pushed into analytical functions, then data transfer is minimized, but query complexity increases

Engineering Contradiction:
Improvedata transferVSAvoidquery execution plan
Core Design Contradiction:
Loss of energyVSDevice complexity

Solution Approach 1:

The patent creates a universal framework that handles multiple scenarios (row-independent AFs, partition-independent AFs, AFs with surplus columns) through a unified approach of defining properties and using them to guide optimization decisions, rather than requiring separate handling for each case.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentUS11409745B2Optimizing the execution order between analytical functions and joins in SQL queries
Publication Date: 2022.08.09 TERADATA US INC
  • US11409745B2 patent drawing
  • US11409745B2 patent drawing
  • US11409745B2 patent drawing

AI summary

Execution of a query invoking an analytical function (AF) is optimized. The query includes a join operation between an AF table and an AuxiliaryTable. A determination is made that the AF includes a plurality of AF properties. Query-level properties about the query are inferred. A determination is made to change an order of the join operation from the plurality of AF properties and query-level properties.