Database Query Optimization for Extended Group-By and Distinct Aggregates

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current database systems face inefficiencies in optimizing queries with extended group-by operators and distinct aggregate functions, which require significant temporary data generation and storage, limiting their computational efficiency.

Innovation Solution

The implementation of optimization techniques such as initial-partial-aggregation, direct-from-base-table, single-distinct-aggregate-exclusion, and sink-table-elimination techniques transforms queries to reduce the need for temporary data storage, allowing for more efficient processing of queries with extended group-by operators and distinct aggregate functions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If extended group-by operators and distinct aggregate functions are implemented in database queries, then query functionality and analytical capability are improved, but temporary data generation and storage requirements increase significantly

Engineering Contradiction:
Improvequery functionalityVSAvoidtemporary data storage
Core Design Contradiction:
Adaptability or versatilityVSQuantity of substance

Solution Approach 1:

The patent applies preliminary action by performing partial aggregation operations before the main query execution. The system identifies aggregate functions that can be computed in advance and stores these intermediate results in optimized temporary structures, reducing the data volume that needs to be processed during the actual query execution of extended group-by operations with distinct aggregate functions.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent segments the query processing into multiple stages: first processing non-distinct aggregate functions separately from distinct aggregate functions, then combining results. This segmentation allows each stage to use optimized processing methods, reducing overall temporary data requirements while maintaining the ability to handle complex extended group-by queries with multiple aggregate functions.

Inventive Principle:
Principle #1Segmentation

2Reliability

If extended group-by operators are used to generate comprehensive aggregated results, then query result completeness is improved, but query execution time increases

Engineering Contradiction:
Improvequery result completenessVSAvoidquery execution time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system performs preliminary aggregation operations for extended group-by operators, computing intermediate results that can be reused across multiple distinct aggregate functions. This preliminary computation establishes a foundation of pre-processed data that accelerates the execution of the complete query while ensuring all required aggregation levels are covered.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent merges the processing of multiple distinct aggregate functions by computing their results based on shared intermediate aggregation data. Instead of executing each distinct aggregate function independently (which would repeat work), the system combines their processing paths, reusing common intermediate results to reduce total execution time while maintaining complete and accurate query results.

Inventive Principle:
Principle #5Merging (Combining)

3Ease of operation

If traditional query optimization methods are used for distinct aggregate functions, then processing simplicity is maintained, but computational efficiency decreases

Engineering Contradiction:
Improveprocessing simplicityVSAvoidcomputational efficiency
Core Design Contradiction:
Ease of operationVSProductivity

Solution Approach 1:

The patent segments distinct aggregate function processing from non-distinct aggregate function processing, allowing each type to be handled with its own optimized methodology. This segmentation maintains conceptual simplicity by clearly separating the two processing paths while achieving high computational efficiency through specialized optimization techniques for each segment.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system changes the processing parameters for distinct aggregate functions by using specialized data structures and computation methods tailored to distinct value handling. This parameter change enables more efficient computation of distinct counts, sums, and other aggregate operations while maintaining clear and manageable processing logic through structured approaches.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS10007700B2Query optimization for group-by extensions and distinct aggregate functions
Publication Date: 2018.06.26 ORACLE INT CORP

AI summary

Techniques for query optimization for group-by extensions and distinct aggregate functions are provided. A query has an extended group-by clause with an extended group-by operator and a first set of group-by columns. The query has one or more distinct aggregate functions and one or more non-distinct aggregate functions. An initial subquery is constructed that generates a partially aggregated initial temporary (PAIT) table when executed. The initial subquery includes a GROUP BY clause with a second set of group-by columns that includes the first set of group-by columns of the extended group-by clause of the query and one or more columns specified by the one or more distinct aggregate functions. One or more subqueries are computed that compute groupings indicated by the extended group-by operator based on the PAIT table generated by the initial subquery.