title: DROP STATS summary: TiDB 数据库中 DROP STATS 的使用概况。

DROP STATS

DROP STATS 语句用于从当前所选定的数据库中删除选定表的统计信息。

语法图

  1. DropStatsStmt ::=
  2. 'DROP' 'STATS' TableName
  3. TableName ::=
  4. Identifier ('.' Identifier)?

示例

  1. CREATE TABLE t(a INT);
  1. Query OK, 0 rows affected (0.01 sec)
  1. SHOW STATS_META WHERE db_name='test' and table_name='t';
  1. +---------+------------+----------------+---------------------+--------------+-----------+
  2. | Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count |
  3. +---------+------------+----------------+---------------------+--------------+-----------+
  4. | test | t | | 2020-05-25 20:34:33 | 0 | 0 |
  5. +---------+------------+----------------+---------------------+--------------+-----------+
  6. 1 row in set (0.00 sec)
  1. DROP STATS t;
  1. Query OK, 0 rows affected (0.00 sec)
  1. SHOW STATS_META WHERE db_name='test' and table_name='t';
  1. Empty set (0.00 sec)

MySQL 兼容性

该语句是 TiDB 对 MySQL 语法的扩展。

另请参阅