Cardinality Estimation Using Automatic Summary Tables

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Traditional database management systems face challenges in generating accurate cardinality estimates for complex queries due to the assumption of independent predicates and the inability to handle complex comparison operators effectively, leading to inefficient query execution plans.

Innovation Solution

The use of statistics from automatic summary tables to improve cardinality estimates by applying adjustment factors that account for predicate dependence, allowing for more accurate cost estimation and optimal query execution plan selection.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If traditional cardinality estimation methods are used based on independent predicate assumptions, then the estimation process is simple and fast, but the accuracy of cardinality estimates deteriorates for complex queries with correlated predicates

Engineering Contradiction:
Improvecardinality estimate accuracyVSAvoidestimation method complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent pre-computes statistics on automatic summary tables that capture correlated predicates before query execution. These pre-computed statistics include cardinality information for predicate combinations, which are stored and reused during query optimization. This preliminary action eliminates the need for complex runtime calculations while improving accuracy.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces automatic summary tables as intermediary structures that bridge the gap between simple independent predicate assumptions and complex correlated predicate realities. These summary tables contain pre-aggregated statistics that mediate between base table statistics and complex query requirements, providing accurate cardinality estimates without full complexity.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If statistics on automatic summary tables are collected and used, then the accuracy of cardinality estimates improves, but the overhead of collecting and storing statistics increases

Engineering Contradiction:
Improvecardinality estimate accuracyVSAvoidstatistics collection time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

Statistics on automatic summary tables are collected in advance during database maintenance windows or idle periods, rather than during query execution. This preliminary collection minimizes impact on query performance while ensuring accurate statistics are available when needed.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system selectively collects statistics only on automatic summary tables that are actually used by queries, rather than maintaining statistics on all possible table combinations. Unused statistics are discarded, reducing overhead while preserving accuracy for relevant queries.

Inventive Principle:
Principle #34Discarding and recovering

3Measurement precision

If complex comparison operators are handled with traditional methods, then the processing is straightforward, but the cardinality estimates for such queries become inaccurate

Engineering Contradiction:
Improvecardinality estimate accuracy for complex predicatesVSAvoidimplementation simplicity
Core Design Contradiction:
Measurement precisionVSEase of manufacture

Solution Approach 1:

Automatic summary tables serve as intermediaries that pre-compute cardinality information for complex comparison operators. These tables capture the effects of complex predicates (such as range queries, pattern matching, and arithmetic comparisons) in advance, allowing the optimizer to reuse accurate results without re-implementing complex analysis logic.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent creates copies of data in automatic summary tables that are optimized for specific query patterns involving complex comparison operators. These copies contain pre-processed information that accurately reflects the selectivity of complex predicates, eliminating the need for the optimizer to directly handle the computational complexity of analyzing such operators.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS8386450B2Query optimization technique for obtaining improved cardinality estimates using statistics on pre-defined queries
Publication Date: 2013.02.26 SNOWFLAKE INC
  • US8386450B2 patent drawing
  • US8386450B2 patent drawing
  • US8386450B2 patent drawing

AI summary

A technique for optimizing execution of a query that accesses data stored on a data store connected to a computer. Statistics on one or more pre-defined queries are used to determine an optimal query execution plan for the query. In particular, improved cardinality estimates are generated for one or more query execution plans for the query using statistics of one or more pre-defined queries that vertically overlap the query. These cardinality estimates are used to make more accurate cost estimates, thus improving the likelihood of determining the optimal query execution plan.