Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
+ [`DROP DATABASE`](/sql-statements/sql-statement-drop-database.md)
+ [`DROP INDEX`](/sql-statements/sql-statement-drop-index.md)
+ [`DROP SEQUENCE`](/sql-statements/sql-statement-drop-sequence.md)
- [`DROP STATS`](/sql-statements/sql-statement-drop-stats.md)
+ [`DROP TABLE`](/sql-statements/sql-statement-drop-table.md)
+ [`DROP USER`](/sql-statements/sql-statement-drop-user.md)
+ [`DROP VIEW`](/sql-statements/sql-statement-drop-view.md)
Expand Down
70 changes: 70 additions & 0 deletions sql-statements/sql-statement-drop-stats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: DROP STATS
summary: An overview of the usage of DROP STATS for the TiDB database.
category: reference
---

# DROP STATS

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

## Synopsis

**DropStatsStmt:**

![DropTableStmt](/media/sqlgram/DropStatsStmt.png)

**TableName:**

![TableName](/media/sqlgram/TableName.png)

## Examples

{{< copyable "sql" >}}

```sql
CREATE TABLE t(a INT);
```

```sql
Query OK, 0 rows affected (0.01 sec)
```

{{< copyable "sql" >}}

```sql
SHOW STATS_META WHERE db_name='test' and table_name='t';
```

```sql
+---------+------------+----------------+---------------------+--------------+-----------+
| 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" >}}

```sql
DROP STATS t;
```

```sql
Query OK, 0 rows affected (0.00 sec)
```

{{< copyable "sql" >}}

```sql
SHOW STATS_META WHERE db_name='test' and table_name='t';
```

```sql
Empty set (0.00 sec)
```

## See also

* [Introduction to Statistics](/statistics.md)
4 changes: 4 additions & 0 deletions statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,7 @@ LOAD STATS 'file_name'
```

`file_name` is the file name of the statistics to be imported.

## See also

* [DROP STATS](/sql-statements/sql-statement-drop-stats.md)