pingcap / pingcap/tidb

Counsider not count the tables with less than 1000 rows in the metric of table stats healthy

Open
#45,875 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

Create a table and insert less than 1000 rows into it. Then query the table stats healthy metric introduced by [#34636](https://github.com/pingcap/tidb/pull/34636).

```
$ curl http://tidb-ip:10080/metrics | grep tidb_statistics_stats_healthy
tidb_statistics_stats_healthy{type="[0,100]"} 1
tidb_statistics_stats_healthy{type="[0,50)"} 1
tidb_statistics_stats_healthy{type="[100,100]"} 0
tidb_statistics_stats_healthy{type="[50,80)"} 0
tidb_statistics_stats_healthy{type="[80,100)"} 0
```

The value in this [0,50) bucket is counted as 1, meaning that the table stats is not so healthy. However, TiDB don't trigger auto analyze when row count less than 1000, and don't seem to take this inaccuracy as a problem. If there is a mix of tables with different size in TiDB cluster, this metric can't tell the difference truely between tables that have expired stats. So the tables with less than 1000 rows can be excluded when counting this metric.

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.