From 7516255dc5c047fe9ac4c579f4aae808d65e69bb Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 17 Jun 2020 11:50:02 +0800 Subject: [PATCH 1/4] sql-statements: update `analyze` statement --- sql-statements/sql-statement-analyze-table.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sql-statements/sql-statement-analyze-table.md b/sql-statements/sql-statement-analyze-table.md index b7e233a751cd4..9916b6a04a17b 100644 --- a/sql-statements/sql-statement-analyze-table.md +++ b/sql-statements/sql-statement-analyze-table.md @@ -1,16 +1,18 @@ --- -title: ANALYZE TABLE | TiDB SQL Statement Reference -summary: An overview of the usage of ANALYZE TABLE for the TiDB database. +title: ANALYZE | TiDB SQL Statement Reference +summary: An overview of the usage of ANALYZE for the TiDB database. category: reference aliases: ['/docs/dev/reference/sql/statements/analyze-table/'] --- -# ANALYZE TABLE +# ANALYZE -This statement updates the statistics that TiDB builds on tables and indexes. It is recommended to run `ANALYZE TABLE` after performing a large batch update or import of records, or when you notice that query execution plans are sub-optimal. +This statement updates the statistics that TiDB builds on tables and indexes. It is recommended to run `ANALYZE` after performing a large batch update or import of records, or when you notice that query execution plans are sub-optimal. TiDB will also automatically update its statistics over time as it discovers that they are inconsistent with its own estimates. +At present, TiDB collects statistical information in two ways: full collection and incremental collection, which are realized through the `ANALYZE TABLE` and `ANALYZE INCREMENTAL TABLE` statements respectively. For detailed usage of these two statements, please refer to [introduction to statistics](/statistics.md) + ## Synopsis **AnalyzeTableStmt:** @@ -64,6 +66,8 @@ mysql> EXPLAIN SELECT * FROM t1 WHERE c1 = 3; This statement is syntactically similar with MySQL. However, `ANALYZE TABLE` may take significantly longer to execute on TiDB, as internally it operates in a different manner. +MySQL does not support the `ANALYZE INCREMENTAL TABLE` statement. TiDB supports incremental collection of statistics. For usage, please refer to [incremental collection document](/statistics.md#incremental-collection). + ## See also * [EXPLAIN](/sql-statements/sql-statement-explain.md) From 7743f30f947aa7076c6b13783af2ce79ad1c2ff9 Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 17 Jun 2020 15:48:23 +0800 Subject: [PATCH 2/4] sql-statement: address comments --- sql-statements/sql-statement-analyze-table.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql-statements/sql-statement-analyze-table.md b/sql-statements/sql-statement-analyze-table.md index 9916b6a04a17b..38c2c70fcfe94 100644 --- a/sql-statements/sql-statement-analyze-table.md +++ b/sql-statements/sql-statement-analyze-table.md @@ -11,7 +11,7 @@ This statement updates the statistics that TiDB builds on tables and indexes. It TiDB will also automatically update its statistics over time as it discovers that they are inconsistent with its own estimates. -At present, TiDB collects statistical information in two ways: full collection and incremental collection, which are realized through the `ANALYZE TABLE` and `ANALYZE INCREMENTAL TABLE` statements respectively. For detailed usage of these two statements, please refer to [introduction to statistics](/statistics.md) +Currently, TiDB collects statistical information in two ways: full collection and (implemented using `ANALYZE TABLE` statement) and incremental collection (implemented using the `ANALYZE INCREMENTAL TABLE` statement). For detailed usage of these two statements, please refer to [introduction to statistics](/statistics.md) ## Synopsis @@ -66,7 +66,7 @@ mysql> EXPLAIN SELECT * FROM t1 WHERE c1 = 3; This statement is syntactically similar with MySQL. However, `ANALYZE TABLE` may take significantly longer to execute on TiDB, as internally it operates in a different manner. -MySQL does not support the `ANALYZE INCREMENTAL TABLE` statement. TiDB supports incremental collection of statistics. For usage, please refer to [incremental collection document](/statistics.md#incremental-collection). +MySQL does not support the `ANALYZE INCREMENTAL TABLE` statement. TiDB supports incremental collection of statistics. For detailed usage, refer to [incremental collection](/statistics.md#incremental-collection). ## See also From fb73ec1fedf6e8fac8853f75990a6225f037fb59 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 17 Jun 2020 18:52:47 +0800 Subject: [PATCH 3/4] Update sql-statements/sql-statement-analyze-table.md --- sql-statements/sql-statement-analyze-table.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-analyze-table.md b/sql-statements/sql-statement-analyze-table.md index 38c2c70fcfe94..6fa1dd2da5f36 100644 --- a/sql-statements/sql-statement-analyze-table.md +++ b/sql-statements/sql-statement-analyze-table.md @@ -11,7 +11,7 @@ This statement updates the statistics that TiDB builds on tables and indexes. It TiDB will also automatically update its statistics over time as it discovers that they are inconsistent with its own estimates. -Currently, TiDB collects statistical information in two ways: full collection and (implemented using `ANALYZE TABLE` statement) and incremental collection (implemented using the `ANALYZE INCREMENTAL TABLE` statement). For detailed usage of these two statements, please refer to [introduction to statistics](/statistics.md) +Currently, TiDB collects statistical information in two ways: full collection (implemented using `ANALYZE TABLE` statement) and incremental collection (implemented using the `ANALYZE INCREMENTAL TABLE` statement). For detailed usage of these two statements, refer to [introduction to statistics](/statistics.md) ## Synopsis From 1c4e3b4235f182b795dd2a868f0ae59dc97abfbc Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Thu, 18 Jun 2020 13:23:55 +0800 Subject: [PATCH 4/4] Update sql-statements/sql-statement-analyze-table.md --- sql-statements/sql-statement-analyze-table.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-analyze-table.md b/sql-statements/sql-statement-analyze-table.md index 6fa1dd2da5f36..009fe9c61d9c5 100644 --- a/sql-statements/sql-statement-analyze-table.md +++ b/sql-statements/sql-statement-analyze-table.md @@ -11,7 +11,7 @@ This statement updates the statistics that TiDB builds on tables and indexes. It TiDB will also automatically update its statistics over time as it discovers that they are inconsistent with its own estimates. -Currently, TiDB collects statistical information in two ways: full collection (implemented using `ANALYZE TABLE` statement) and incremental collection (implemented using the `ANALYZE INCREMENTAL TABLE` statement). For detailed usage of these two statements, refer to [introduction to statistics](/statistics.md) +Currently, TiDB collects statistical information in two ways: full collection (implemented using the `ANALYZE TABLE` statement) and incremental collection (implemented using the `ANALYZE INCREMENTAL TABLE` statement). For detailed usage of these two statements, refer to [introduction to statistics](/statistics.md) ## Synopsis