From d96cab9489727645b391d7fd2028f731daf1cba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 9 Apr 2024 09:21:53 +0200 Subject: [PATCH 1/2] ebnf show stats healthy --- .../sql-statement-show-stats-healthy.md | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/sql-statements/sql-statement-show-stats-healthy.md b/sql-statements/sql-statement-show-stats-healthy.md index 22e214cf61497..a010e589107a2 100644 --- a/sql-statements/sql-statement-show-stats-healthy.md +++ b/sql-statements/sql-statement-show-stats-healthy.md @@ -7,28 +7,23 @@ summary: An overview of the usage of SHOW STATS_HEALTHY for TiDB database. The `SHOW STATS_HEALTHY` statement shows an estimation of how accurate statistics are believed to be. Tables with a low percentage health may generate sub-optimal query execution plans. -The health of a table can be improved by running the `ANALYZE` table command. `ANALYZE` runs automatically when the health drops below the [`tidb_auto_analyze_ratio`](/system-variables.md#tidb_auto_analyze_ratio) threshold. +The health of a table can be improved by running the [`ANALYZE TABLE` statement](/sql-statements/sql-statement-analyze-table.md). `ANALYZE` runs automatically when the health drops below the [`tidb_auto_analyze_ratio`](/system-variables.md#tidb_auto_analyze_ratio) threshold. ## Synopsis -**ShowStmt** +```ebnf+diagram +ShowStatsHealthyStmt ::= + "SHOW" "STATS_HEALTHY" ShowLikeOrWhere? -![ShowStmt](/media/sqlgram/ShowStmt.png) - -**ShowTargetFiltertable** - -![ShowTargetFilterable](/media/sqlgram/ShowTargetFilterable.png) - -**ShowLikeOrWhereOpt** - -![ShowLikeOrWhereOpt](/media/sqlgram/ShowLikeOrWhereOpt.png) +ShowLikeOrWhere ::= + "LIKE" SimpleExpr +| "WHERE" Expression +``` ## Examples Load example data and run `ANALYZE`: -{{< copyable "sql" >}} - ```sql CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY auto_increment, @@ -62,8 +57,6 @@ mysql> SHOW STATS_HEALTHY; Perform a bulk update deleting approximately 30% of the records. Check the health of the statistics: -{{< copyable "sql" >}} - ```sql DELETE FROM t1 WHERE id BETWEEN 101010 AND 201010; # delete about 30% of records SHOW STATS_HEALTHY; From 66608358e23fd712eb334d57605e7ee0ac5f4cfa Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Thu, 18 Apr 2024 10:34:44 +0800 Subject: [PATCH 2/2] wording updates --- sql-statements/sql-statement-show-stats-healthy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-show-stats-healthy.md b/sql-statements/sql-statement-show-stats-healthy.md index a010e589107a2..631e2d97c1d28 100644 --- a/sql-statements/sql-statement-show-stats-healthy.md +++ b/sql-statements/sql-statement-show-stats-healthy.md @@ -7,7 +7,7 @@ summary: An overview of the usage of SHOW STATS_HEALTHY for TiDB database. The `SHOW STATS_HEALTHY` statement shows an estimation of how accurate statistics are believed to be. Tables with a low percentage health may generate sub-optimal query execution plans. -The health of a table can be improved by running the [`ANALYZE TABLE` statement](/sql-statements/sql-statement-analyze-table.md). `ANALYZE` runs automatically when the health drops below the [`tidb_auto_analyze_ratio`](/system-variables.md#tidb_auto_analyze_ratio) threshold. +The health of a table can be improved by running the [`ANALYZE`](/sql-statements/sql-statement-analyze-table.md) statement. `ANALYZE` runs automatically when the health drops below the [`tidb_auto_analyze_ratio`](/system-variables.md#tidb_auto_analyze_ratio) threshold. ## Synopsis