From 6eeab0b77d7b4802aaaf21ec33e882f4f2cb53eb Mon Sep 17 00:00:00 2001 From: Feng Liyuan Date: Wed, 17 Jun 2020 19:24:31 +0800 Subject: [PATCH 1/3] sql-statements:add drop-stats.md --- TOC.md | 1 + sql-statements/sql-statement-drop-stats.md | 70 ++++++++++++++++++++++ statistics.md | 4 ++ 3 files changed, 75 insertions(+) create mode 100644 sql-statements/sql-statement-drop-stats.md diff --git a/TOC.md b/TOC.md index 31442104ad26c..fefce467ff8b9 100644 --- a/TOC.md +++ b/TOC.md @@ -228,6 +228,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) diff --git a/sql-statements/sql-statement-drop-stats.md b/sql-statements/sql-statement-drop-stats.md new file mode 100644 index 0000000000000..1bb974c1e070a --- /dev/null +++ b/sql-statements/sql-statement-drop-stats.md @@ -0,0 +1,70 @@ +--- +title: DROP STATS +summary: An overview of the usage of DROP STATS for the TiDB database. +category: reference +--- + +# DROP STATS + +`DROP STATS` 语句用于从当前所选定的数据库中删除选定表的统计信息。 + +## 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) \ No newline at end of file diff --git a/statistics.md b/statistics.md index 1f137e7eb61ed..ff4f2a07965b6 100644 --- a/statistics.md +++ b/statistics.md @@ -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) \ No newline at end of file From 648212398580b510ce1bee186bf4f6d57dabf575 Mon Sep 17 00:00:00 2001 From: Feng Liyuan Date: Wed, 17 Jun 2020 19:27:15 +0800 Subject: [PATCH 2/3] sql-statements:add drop-stats.md --- sql-statements/sql-statement-drop-stats.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-drop-stats.md b/sql-statements/sql-statement-drop-stats.md index 1bb974c1e070a..4ff34b6c91841 100644 --- a/sql-statements/sql-statement-drop-stats.md +++ b/sql-statements/sql-statement-drop-stats.md @@ -6,7 +6,7 @@ category: reference # DROP STATS -`DROP STATS` 语句用于从当前所选定的数据库中删除选定表的统计信息。 +`DROP STATS` statement is used to delete the statistical information of the selected table from the selected database. ## Synopsis From 4f919dcaa3d621be6d056e32b2f0b6a991cb04be Mon Sep 17 00:00:00 2001 From: Feng Liyuan Date: Wed, 17 Jun 2020 19:38:06 +0800 Subject: [PATCH 3/3] Update sql-statements/sql-statement-drop-stats.md Co-authored-by: Keke Yi <40977455+yikeke@users.noreply.github.com> --- sql-statements/sql-statement-drop-stats.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql-statements/sql-statement-drop-stats.md b/sql-statements/sql-statement-drop-stats.md index 4ff34b6c91841..5fe1ee64fe25a 100644 --- a/sql-statements/sql-statement-drop-stats.md +++ b/sql-statements/sql-statement-drop-stats.md @@ -6,7 +6,7 @@ category: reference # DROP STATS -`DROP STATS` statement is used to delete the statistical information of the selected table from the selected database. +The `DROP STATS` statement is used to delete the statistics of the selected table from the selected database. ## Synopsis @@ -67,4 +67,4 @@ Empty set (0.00 sec) ## See also -* [Introduction to Statistics](/statistics.md) \ No newline at end of file +* [Introduction to Statistics](/statistics.md)