The number of rows counted by indexing the same table is different

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 同一张表,建索引统计出的行数不一样

| username: TiDBer_Terry261

[TiDB Usage Environment] Production Environment / Testing / Poc
[TiDB Version]
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Problem Phenomenon and Impact]

Creating an index on the same table, with the table’s data remaining unchanged, no insertions or deletions, the ROW_COUNT displayed is different each time and the differences are significant. What could be the reason for this?
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]

| username: zhanggame1 | Original post link

This is an estimated value, right? How many rows are there exactly? Can you directly show the table?

| username: TiDBer_Terry261 | Original post link

“show table” is fixed.

| username: tidb菜鸟一只 | Original post link

Isn’t this the number of rows in the index you created? Are none of the fields in your index empty?

| username: TiDBer_Terry261 | Original post link

None of the fields are empty.

| username: xingzhenxiang | Original post link

Isn’t this a problem with the statistics? Try reanalyzing it and see the process. There is a difference between the earlier and later statistics.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.