Synopsis Merging for Distinct Value Estimation in Large Databases

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current database systems face inefficiencies in accurately estimating the number of distinct values (NDV) in large tables, particularly due to inadequate sampling methods that result in either excessive data reading or reduced randomness, leading to inaccurate statistics.

Innovation Solution

The approach involves generating a synopsis by mapping column values to a domain using a uniform hash function, splitting the synopsis when it reaches capacity to discard less frequently occurring values, and merging synopses from different partitions to estimate the NDV, allowing for incremental maintenance of database statistics.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If row sampling is used to estimate NDV, then randomness of sample is improved, but data reading volume increases

Engineering Contradiction:
ImproveNDV estimation accuracyVSAvoiddata reading volume
Core Design Contradiction:
Measurement precisionVSQuantity of substance

Solution Approach 1:

The patent divides the table into multiple partitions and generates separate synopses for each partition. This segmentation allows the system to process smaller portions of data independently, reducing the total data reading volume while maintaining estimation accuracy through the merging of partition-level synopses into a global synopsis.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent applies block sampling that reads a random sample of blocks and uses all rows in those blocks, rather than reading entire rows for random sampling. This partial action approach reduces data reading volume while still providing sufficient randomness for accurate NDV estimation through the synopsis data structure.

Inventive Principle:
Principle #16Partial or excessive action

2Quantity of substance

If block sampling is used to estimate NDV, then data reading volume is reduced, but sample randomness decreases

Engineering Contradiction:
Improvedata reading volumeVSAvoidNDV estimation accuracy
Core Design Contradiction:
Quantity of substanceVSMeasurement precision

Solution Approach 1:

The patent introduces a synopsis data structure as an intermediary between the sampled data and the NDV estimation. The synopsis captures essential information about distinct values in a compact form, allowing block sampling to reduce data reading volume while the synopsis mechanism preserves estimation accuracy by tracking distinct values efficiently.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent creates a simplified copy of the data distribution through the synopsis structure, which stores representative information about distinct values without requiring the full original data. This copying approach enables accurate NDV estimation from block samples while minimizing data reading requirements.

Inventive Principle:
Principle #26Copying

3Measurement precision

If 100% sample is used for manual statistic collection, then NDV estimation accuracy is improved, but resource consumption increases

Engineering Contradiction:
ImproveNDV estimation accuracyVSAvoidresource consumption
Core Design Contradiction:
Measurement precisionVSUse of energy by moving object

Solution Approach 1:

The patent segments the statistic collection process into partition-level synopses that can be generated independently and merged later. This allows accurate NDV estimation through synopsis merging without requiring resource-intensive 100% sampling of the entire table, significantly reducing resource consumption while maintaining accuracy.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent uses synopsis structures that create compact representations of data distributions, serving as efficient copies that enable accurate statistic estimation without processing the full dataset. This copying approach maintains NDV estimation accuracy while avoiding the high resource consumption of complete data scanning.

Inventive Principle:
Principle #26Copying

4Measurement precision

If synopsis capacity is increased to store more values, then NDV estimation accuracy is improved, but memory consumption increases

Engineering Contradiction:
ImproveNDV estimation accuracyVSAvoidmemory consumption
Core Design Contradiction:
Measurement precisionVSQuantity of substance

Solution Approach 1:

The patent segments the synopsis into partition-level components, each storing distinct values for a specific partition. This segmentation allows the global NDV to be estimated by merging smaller partition synopses, improving overall estimation accuracy while keeping individual synopsis memory consumption manageable through distributed storage across partitions.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS7603339B2Merging synopses to determine number of distinct values in large databases
Publication Date: 2009.10.13 ORACLE INT CORP
  • US7603339B2 patent drawing
  • US7603339B2 patent drawing
  • US7603339B2 patent drawing

AI summary

A method and apparatus for merging synopses to determine a database statistic, e.g., a number of distinct values (NDV), is disclosed. The merging can be used to determine an initial database statistic or to perform incremental statistics maintenance. For example, each synopsis can pertain to a different partition, such that merging the synopses generates a global statistic. When performing incremental maintenance, only those synopses whose partitions have changed need to be updated. Each synopsis contains domain values that summarize the statistic. However, the synopses may initially contain domain values that are not compatible with each other. Prior to merging the synopses the domain values in each synopsis is made compatible with the domain values in the other synopses. The adjustment is made such that each synopsis represents the same range of domain values, in one embodiment. After “compatible synopses” are formed, the synopses are merged by taking the union of the compatible synopses.