From 83b729cc2504a454553c0c2accff49fcd15f9767 Mon Sep 17 00:00:00 2001 From: doc-claw-bot Date: Tue, 18 Aug 2026 15:16:09 +0000 Subject: [PATCH 1/2] docs: fix DROP STATS stats_meta example --- sql-statements/sql-statement-drop-stats.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-drop-stats.md b/sql-statements/sql-statement-drop-stats.md index 00e5a5cec68cc..00cd8bbbcdb19 100644 --- a/sql-statements/sql-statement-drop-stats.md +++ b/sql-statements/sql-statement-drop-stats.md @@ -81,12 +81,21 @@ DROP STATS t; Query OK, 0 rows affected (0.00 sec) ``` +After `DROP STATS`, `SHOW STATS_META` still returns the table's row count +and modify count. `DROP STATS` clears histogram-related statistics such as +TopN and buckets, but does not delete the `STATS_META` row. + ```sql SHOW STATS_META WHERE db_name='test' and table_name='t'; ``` ``` -Empty set (0.00 sec) ++---------+------------+----------------+---------------------+--------------+-----------+ +| Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count | ++---------+------------+----------------+---------------------+--------------+-----------+ +| test | t | | 2020-05-25 20:34:33 | 0 | 0 | ++---------+------------+----------------+---------------------+--------------+-----------+ +1 row in set (0.00 sec) ``` ## MySQL compatibility From 7ff41027864dd1bf9d86f3a53202f8bec2677817 Mon Sep 17 00:00:00 2001 From: qiancai Date: Tue, 25 Aug 2026 16:21:10 +0800 Subject: [PATCH 2/2] Update sql-statement-drop-stats.md --- sql-statements/sql-statement-drop-stats.md | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sql-statements/sql-statement-drop-stats.md b/sql-statements/sql-statement-drop-stats.md index 00cd8bbbcdb19..980d9333bada0 100644 --- a/sql-statements/sql-statement-drop-stats.md +++ b/sql-statements/sql-statement-drop-stats.md @@ -65,11 +65,11 @@ SHOW STATS_META WHERE db_name='test' and table_name='t'; ``` ``` -+---------+------------+----------------+---------------------+--------------+-----------+ -| Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count | -+---------+------------+----------------+---------------------+--------------+-----------+ -| test | t | | 2020-05-25 20:34:33 | 0 | 0 | -+---------+------------+----------------+---------------------+--------------+-----------+ ++---------+------------+----------------+---------------------+--------------+-----------+-------------------+ +| Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count | Last_analyze_time | ++---------+------------+----------------+---------------------+--------------+-----------+-------------------+ +| test | t | | 2020-05-25 20:34:33 | 0 | 0 | NULL | ++---------+------------+----------------+---------------------+--------------+-----------+-------------------+ 1 row in set (0.00 sec) ``` @@ -81,20 +81,18 @@ DROP STATS t; Query OK, 0 rows affected (0.00 sec) ``` -After `DROP STATS`, `SHOW STATS_META` still returns the table's row count -and modify count. `DROP STATS` clears histogram-related statistics such as -TopN and buckets, but does not delete the `STATS_META` row. +`DROP STATS` deletes statistics such as TopN and histogram buckets of the table, but does not delete the record of the table from `STATS_META`. Therefore, after you execute `DROP STATS`, `SHOW STATS_META` still returns the `Modify_count` and `Row_count` information of the table. ```sql SHOW STATS_META WHERE db_name='test' and table_name='t'; ``` ``` -+---------+------------+----------------+---------------------+--------------+-----------+ -| Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count | -+---------+------------+----------------+---------------------+--------------+-----------+ -| test | t | | 2020-05-25 20:34:33 | 0 | 0 | -+---------+------------+----------------+---------------------+--------------+-----------+ ++---------+------------+----------------+---------------------+--------------+-----------+-------------------+ +| Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count | Last_analyze_time | ++---------+------------+----------------+---------------------+--------------+-----------+-------------------+ +| test | t | | 2020-05-25 20:34:33 | 0 | 0 | NULL | ++---------+------------+----------------+---------------------+--------------+-----------+-------------------+ 1 row in set (0.00 sec) ```