Dimensional Hierarchy Collapsing for SQL Query Optimization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Structured Query Language (SQL) queries used in database operations often return more rows than necessary, especially when dealing with requests containing dimension hierarchies, leading to sub-optimal performance and large result sets.

Innovation Solution

A method is introduced to collapse a data tree hierarchy into a two-column data structure, where characteristic leaf-node key values are in the first column and corresponding System Identification (SID) values are in the second column, allowing for efficient aggregation and filtering, thereby generating an optimal SQL query that minimizes the number of rows returned.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If a SQL query is generated based on dimension hierarchy leaf-node data, then the query can be constructed using available BW InfoObjects, but the result set contains many more rows than necessary

Engineering Contradiction:
Improvequery execution efficiencyVSAvoidnumber of rows in result set
Core Design Contradiction:
ProductivityVSQuantity of substance

Solution Approach 1:

The patent applies preliminary action by pre-calculating and storing the mapping between hierarchy node SIDs and their corresponding leaf-node key values in a translation table before query execution. This allows the query generation process to directly use aggregated SID values without having to traverse and aggregate leaf-node data at query time, thus reducing the result set size while maintaining query correctness.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces a translation table as an intermediary between the BW InfoObjects and the SQL query execution. This translation table stores the pre-computed mapping relationships, acting as a mediator that translates hierarchy node SIDs into their corresponding leaf-node key values, thereby avoiding direct aggregation of large numbers of leaf-node rows during query execution.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If data is aggregated at the leaf-node level, then all necessary detail data can be retrieved, but query performance deteriorates due to processing millions of rows

Engineering Contradiction:
Improvedata completenessVSAvoidquery processing time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent performs preliminary aggregation by pre-computing the mapping from hierarchy node SIDs to their descendant leaf-node key values and storing this mapping in a translation table. This allows queries to aggregate data at the appropriate hierarchy level by working with a small set of SID values rather than traversing and aggregating millions of leaf-node rows, thus maintaining data completeness while dramatically reducing query processing time.

Inventive Principle:
Principle #10Preliminary action

3Loss of information

If the query returns all leaf-node rows, then complete detail data is available, but the result set size becomes unmanageably large

Engineering Contradiction:
Improvedata detail levelVSAvoidresult set row count
Core Design Contradiction:
Loss of informationVSQuantity of substance

Solution Approach 1:

The patent uses a translation table as an intermediary structure that stores the mapping between hierarchy node SIDs and their corresponding leaf-node key values. This intermediary allows the system to work with compact SID representations during query processing while still being able to retrieve complete leaf-node detail data when needed, thus maintaining data detail availability while keeping result set sizes manageable.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent creates a copied representation of the hierarchy relationships in the translation table, storing the mapping from parent node SIDs to child node key values. This copied structure allows queries to operate on a compact representation of the data hierarchy without losing access to the complete detailed data, effectively decoupling the query processing workload from the actual data volume.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS8229966B2System to generate a structured query language query by using a dimensional hierarchy
Publication Date: 2012.07.24 TERADATA US INC
  • US8229966B2 patent drawing
  • US8229966B2 patent drawing
  • US8229966B2 patent drawing

AI summary

A tree-structured database is collapsed into a two-column table. The two-column table includes a characteristic key value for a given leaf node in the first column and the system identification (SID) relating to the characteristic key value in the second column and also identifying the node that leads to the characteristic key value. Data is presented by coupling the characteristic key value with a transaction table. A query that is formulated in an infocube may be translated to a relational data base query, collapsed, and reformulated into an infocube result set, or vice versa.