Database Optimizer Statistics via Check Tables

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing database management systems face inefficiencies in determining optimizer statistics, especially for large tables, as current methods are resource- and time-consuming, leading to potential selection of inefficient search strategies due to inaccurate extrapolations.

Innovation Solution

The system efficiently determines optimizer statistics by utilizing check tables and cardinality information to update statistics for fields associated with check tables, allowing for accurate and rapid calculation without impacting system performance.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If optimizer statistics are determined by reading each row of a large table, then measurement precision is improved, but loss of time and use of energy worsen

Engineering Contradiction:
Improveaccuracy of optimizer statisticsVSAvoidtime to determine statistics
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The system performs preliminary actions by maintaining check tables that store pre-computed statistics about the distribution of values in foreign key fields. When statistics are needed for query optimization, the system can directly query these pre-prepared check tables rather than scanning the entire base table, thus obtaining accurate statistics efficiently.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces check tables as intermediary structures between the base table and the optimizer. These check tables act as mediators that store summarized statistical information, allowing the optimizer to obtain accurate statistics without directly accessing and scanning the entire base table, thus reducing time and energy consumption.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Loss of time

If optimizer statistics are determined by sampling rows from large tables, then loss of time is reduced, but measurement precision worsens

Engineering Contradiction:
Improvetime to determine statisticsVSAvoidaccuracy of optimizer statistics
Core Design Contradiction:
Loss of timeVSMeasurement precision

Solution Approach 1:

The system pre-computes and stores complete statistical information in check tables during data insertion or update operations. This preliminary action ensures that when the optimizer needs statistics, accurate data is already available without requiring sampling or extrapolation, thus maintaining high measurement precision while minimizing query time.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

Check tables serve as intermediary structures that maintain accurate statistical summaries of the base table data. Rather than sampling the base table directly, the optimizer queries these intermediary check tables which contain pre-computed, accurate statistics, thus eliminating the need for sampling while keeping time consumption low.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Measurement precision

If check tables are maintained for all fields, then measurement precision is improved, but device complexity worsens

Engineering Contradiction:
Improveaccuracy of optimizer statisticsVSAvoidnumber of check tables
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The system applies local quality by creating check tables selectively only for foreign key fields where statistical accuracy is most critical for query optimization. Not all fields require check tables - only those that are frequently used in joins or where value distribution significantly impacts query planning. This selective approach maintains measurement precision where needed while avoiding unnecessary complexity.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The system changes the parameter of check table creation from a universal approach (all fields) to a conditional approach based on field characteristics. Check tables are created only for fields meeting specific criteria (e.g., foreign key fields with high selectivity), thus reducing the total number of check tables and system complexity while maintaining statistical accuracy for the most important fields.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS8732138B2Determination of database statistics using application logic
Publication Date: 2014.05.20 SAP SE
  • US8732138B2 patent drawing
  • US8732138B2 patent drawing
  • US8732138B2 patent drawing

AI summary

A database system may provide determination of statistics for a field of a database table. The determination may include determination of whether the field of the table is associated with a check table, and, if the field of the table is associated with a check table, determination of a number of distinct values of the field in the table based on a number of distinct values of the field in the check table.