pingcap / pingcap/tidb

Planner: Small NDV results in too many histogram buckets.

Open
#53,950 0 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
The concept behind histograms for optimizer statistics is to represent a range of values - it's cardinality, and number of duplicates per value. Having a very small number of values per bucket results in too many buckets - which drives up the number of statistics we manage.

There are exceptions - where capturing the ranges such that gaps appear between buckets vs within bucket could result in the need for more buckets - but sampling can distort this and mislead the optimizer.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.