The size of the statistics table, data size, and index size in TiDB are all 0

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

Original topic: tidb中统计表的大小,数据大小,索引大小,全为0

| username: TiDBer_OB4kHrS7

[TiDB Usage Environment] Production Environment
[TiDB Version] V5.3.3
[Reproduction Path] What operations were performed when the problem occurred
[Encountered Problem: Problem Phenomenon and Impact]
Using the command line to count the number of rows in the table, data size, and index size, all statistics are 0
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachment: Screenshot/Log/Monitoring]

| username: 小龙虾爱大龙虾 | Original post link

Collect statistics

| username: TiDBer_OB4kHrS7 | Original post link

Collected already, it’s the same.

| username: 路在何chu | Original post link

Are all the tables like this?

| username: TiDBer_OB4kHrS7 | Original post link

Partial table

| username: 路在何chu | Original post link

Delete the table statistics that are zero, and then collect them again to see.

| username: 像风一样的男子 | Original post link

Did you get any results from querying all the table information?

| username: TiDBer_OB4kHrS7 | Original post link

There is a part that is all zeros.

| username: TiDBer_OB4kHrS7 | Original post link

The image you provided is not visible. Please provide the text you need translated.

| username: 小龙虾爱大龙虾 | Original post link

Let’s check if there really is no data. Normally, the number of rows shouldn’t be 0.

| username: TiDBer_OB4kHrS7 | Original post link

Yes, if you go directly to count, there are values.

| username: 路在何chu | Original post link

It is also possible that your table data volume is too small, and when counted in bytes, it is ignored as 0.

| username: TiDBer_OB4kHrS7 | Original post link

No, some tables have over 100 million records when counted, and the table size is several tens of gigabytes.

| username: zhanggame1 | Original post link

Try restarting the TiDB server, one by one.

| username: heiwandou | Original post link

It feels like a bug, I think I saw it somewhere before.

| username: andone | Original post link

Collect statistics or try restarting.

| username: WalterWj | Original post link

I think you can delete the statistics and then try collecting them again. :thinking:

DROP STATS TableName;
ANALYZE TABLE TableName

| username: TiDBer_OB4kHrS7 | Original post link

The analysis cannot be completed, and the connection times out as soon as the analysis starts.
mysql> analyze table oms_online.orders;
ERROR 2013 (HY000): Lost connection to MySQL server during query

| username: Soysauce520 | Original post link

The storage structure of TiDB is different from MySQL. Are you using MySQL statements?

| username: 路在何chu | Original post link

The sentence is the same as analyze.