Database Aggregates on Distinct Values via Spool Files

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Database systems face inefficiencies and inaccuracies when computing aggregates on distinct attribute values for group-by operations involving multiple levels of grouping sets, as conventional methods fail to produce accurate results when a DISTINCT aggregate is specified.

Innovation Solution

The database system employs a two-step process involving the creation of a spool file containing distinct attribute values, allowing higher-level group-bys to be computed from this spool rather than the original table, and reusing intermediate spool files to efficiently calculate aggregates across multiple grouping sets.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If conventional group-by computation methods are used for multiple grouping sets, then computation efficiency is improved by calculating higher-level group-bys from lower-level results, but accuracy deteriorates when DISTINCT aggregates are specified

Engineering Contradiction:
Improvecomputation efficiencyVSAvoidaggregate accuracy
Core Design Contradiction:
ProductivityVSMeasurement precision

Solution Approach 1:

The patent segments the computation process into distinct phases: first computing lower-level group-bys with DISTINCT aggregates, storing results in spool files, then using these spool files as input for higher-level group-bys. This segmentation allows each phase to maintain accuracy while enabling efficient reuse of intermediate results.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary computation of lower-level group-bys with DISTINCT aggregates and stores them in spool files before computing higher-level group-bys. This preliminary action ensures that distinct value aggregates are accurately computed once and reused, maintaining accuracy while improving efficiency.

Inventive Principle:
Principle #10Preliminary action

2Measurement precision

If DISTINCT aggregates are computed for each grouping set from the base table, then accuracy is maintained, but computation time increases significantly

Engineering Contradiction:
Improveaggregate accuracyVSAvoidcomputation time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent merges the computation of multiple grouping sets by using spool files containing DISTINCT aggregate results from lower-level group-bys as input for higher-level group-bys. This combining approach computes DISTINCT aggregates once and reuses them across multiple grouping sets, reducing redundant computation while maintaining accuracy.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The patent maintains continuity of useful action by keeping DISTINCT aggregate results in spool files and continuously reusing them for higher-level group-bys. This eliminates repeated computation of the same DISTINCT aggregates, significantly reducing computation time while preserving accuracy.

Inventive Principle:
Principle #20Continuity of useful action

3Productivity

If spool files are created and reused for multiple grouping sets, then computation efficiency is improved, but system resource usage increases

Engineering Contradiction:
Improvecomputation efficiencyVSAvoidmemory usage
Core Design Contradiction:
ProductivityVSQuantity of substance

Solution Approach 1:

The patent creates spool files as copies of DISTINCT aggregate results from lower-level group-bys, which are then reused as input for higher-level group-bys. This copying mechanism enables efficient reuse of intermediate results without requiring the base table to be repeatedly scanned, improving computation efficiency while managing memory resources through structured spool file creation.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS7725455B1Computing aggregates on distinct attribute values
Publication Date: 2010.05.25 TERADATA US INC
  • US7725455B1 patent drawing
  • US7725455B1 patent drawing
  • US7725455B1 patent drawing

AI summary

A database system computes an aggregate on distinct values of at least one attribute for each of plural groups specified by multiple levels of grouping sets. Distinct values of the at least one attribute are identified and stored in a first table. The first table is used to compute aggregates for groups specified by a first grouping set and for groups specified by a second grouping set.