pingcap / pingcap/tidb

A small table with high modify count without table analyze, missing the est rows in plan

Open
#62,924 5 comments 0 reactions 0 assignees View on GitHub
component/statistics epic/cardinality-estimation sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

The planner always using the pseudo stats and pseudo est radio in cost model.

### 1. Minimal reproduce step (Required)

1. Table size is less than 1000 will not be analyzed
According to "To avoid the situation that modifying a small amount of data on a small table frequently triggers the automatic update, when a table has less than 1000 rows, such data modifying does not trigger the automatic update in TiDB.", this table will never be analyzed after the first analysis.

2. However, this table has a high modifyCount, which is currently 4759.

3. The cost model using the default estimate ratio and default stats for table
The default pseudo-estimate-ratio in TiDB is 0.8. Therefore, the ratio is much greater than 1.0, which causes the planner to always use pseudo statistics.

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.