Skip to content

Latest commit

 

History

History
76 lines (53 loc) · 1.44 KB

sql-statement-drop-stats.md

File metadata and controls

76 lines (53 loc) · 1.44 KB
title summary
DROP STATS
An overview of the usage of DROP STATS for the TiDB database.

DROP STATS

The DROP STATS statement is used to delete the statistics of the selected table from the selected database.

Synopsis

DropStatsStmt ::=
    'DROP' 'STATS' TableNameList 

TableNameList ::=
    TableName ( ',' TableName )*

TableName ::=
    Identifier ('.' Identifier)?

Examples

{{< copyable "sql" >}}

CREATE TABLE t(a INT);
Query OK, 0 rows affected (0.01 sec)

{{< copyable "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 |
+---------+------------+----------------+---------------------+--------------+-----------+
1 row in set (0.00 sec)

{{< copyable "sql" >}}

DROP STATS t;
Query OK, 0 rows affected (0.00 sec)

{{< copyable "sql" >}}

SHOW STATS_META WHERE db_name='test' and table_name='t';
Empty set (0.00 sec)

MySQL compatibility

This statement is a TiDB extension to MySQL syntax.

See also