Inline View Segmentation for Accurate Multi-Level Aggregation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing query generators, such as Oracle Discoverer, often produce SQL statements that yield relationally correct but misleading results when dealing with multiple levels of aggregation across separate detail tables joined to a single master table, requiring complex reaggregation or incorrect display of higher aggregation levels.

Innovation Solution

A query generator that identifies join subgraphs, generates inline views for each subgraph to perform aggregation functions within that subgraph, and joins these views on common GROUP BY items and GROUPING_IDs to ensure accurate computation of all aggregation levels without reaggregation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If normal SQL generation algorithms are used to join multiple detail tables to a single master table, then the query can be executed with standard joins, but the aggregation results become misleading or incorrect at higher aggregation levels

Engineering Contradiction:
Improveaggregation correctnessVSAvoidquery structure complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The query structure is segmented into multiple inline views, each handling aggregation for a specific detail table. This segmentation isolates aggregation operations to prevent cross-contamination between detail tables, ensuring correct aggregation at all levels while maintaining manageable query complexity through modular organization.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Inline views serve as intermediary structures between the master table and detail tables. These intermediaries perform localized aggregation before joining, acting as buffers that prevent aggregation errors from propagating. The inline views mediate the relationship between detailed data and aggregated results, ensuring mathematical correctness.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If aggregation is computed locally by the query tool rather than in the database, then higher aggregation levels can be computed, but performance deteriorates and correctness cannot be guaranteed in all scenarios

Engineering Contradiction:
Improveaggregation correctnessVSAvoidquery execution performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

Aggregation operations are performed preliminarily within inline views in the database before results are returned to the query tool. This preliminary action ensures that aggregation is mathematically correct and performed on the actual database data, while the query tool only needs to perform simple joins on already-aggregated results, maintaining both correctness and performance.

Inventive Principle:
Principle #10Preliminary action

3Reliability

If complex reaggregation structures are implemented to ensure correct aggregation, then higher aggregation levels can be computed correctly, but the device complexity and difficulty of operation increase significantly

Engineering Contradiction:
Improveaggregation correctnessVSAvoidquery generation ease
Core Design Contradiction:
ReliabilityVSEase of operation

Solution Approach 1:

The inline view pattern serves as a universal solution that handles multiple aggregation scenarios simultaneously. Whether dealing with single or multiple detail tables, base or higher aggregation levels, the same inline view mechanism applies. This multi-functionality simplifies query generation by providing a consistent approach across diverse aggregation needs.

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

Solution Approach 2:

Each inline view is self-contained and performs its own aggregation operations independently using its own GROUP BY clause. The views are self-sufficient units that automatically handle their aggregation logic without requiring external reaggregation mechanisms. This self-service approach eliminates the need for complex post-processing or manual intervention.

Inventive Principle:
Principle #25Self-service

4Device complexity

If simple joins are used without inline views, then the query structure remains simple, but aggregation functions refer to data from multiple detail tables and produce incorrect results

Engineering Contradiction:
Improvequery structure simplicityVSAvoidaggregation accuracy
Core Design Contradiction:
Device complexityVSMeasurement precision

Solution Approach 1:

Inline views create temporary, disposable result sets that exist only for the duration of the query execution. Each inline view computes aggregation on-the-fly and immediately, without requiring persistent stored procedures or complex materialized views. These lightweight, ephemeral structures provide precise aggregation with minimal overhead, delivering accuracy without long-term complexity.

Inventive Principle:
Principle #27Cheap short-living objects (Disposable)

Data Source

PatentUS7797307B2Query generation method for queries for inline views for aggregation referring to identified subgraphs
Publication Date: 2010.09.14 ORACLE INT CORP
  • US7797307B2 patent drawing
  • US7797307B2 patent drawing
  • US7797307B2 patent drawing

AI summary

A query generator for generating a query which retrieves a desired set of data from a relational database and performs one or more aggregation functions on the set of data is disclosed. The query generator is adapted to:a) receive user input indicating the desired set of data and the aggregation functions to be performed;b) identify each join subgraph for the desired set of data;c) for each join subgraph identified in step (b), generate an inline view which, on execution, performs all of the aggregation functions that refer only to data within that join subgraph; andd) generate an output query comprising the inline views generated in step (c) as arguments of a join.