From 7a50c638018ad249233ce39848654b4f94de8d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 5 Dec 2023 17:28:28 +0100 Subject: [PATCH 1/8] Add/clarify SQL length limits --- dashboard/dashboard-slow-query.md | 4 ++++ information-schema/information-schema-slow-query.md | 11 +++++++---- system-variables.md | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dashboard/dashboard-slow-query.md b/dashboard/dashboard-slow-query.md index 4c400000c52b0..d03ce4f386595 100644 --- a/dashboard/dashboard-slow-query.md +++ b/dashboard/dashboard-slow-query.md @@ -60,6 +60,10 @@ Click any item in the list to display detailed execution information of the slow ### SQL +> **Note:** +> +> The maximum length of the query is limited by the [`tidb_stmt_summary_max_sql_length`](/system-variables.md#tidb_stmt_summary_max_sql_length-new-in-v40) system variable. + Click the **Expand** button to view the detailed information of an item. Click the **Copy** button to copy the detailed information to the clipboard. ### Execution plans diff --git a/information-schema/information-schema-slow-query.md b/information-schema/information-schema-slow-query.md index 8510aec12ffc5..ee65dbf8cb322 100644 --- a/information-schema/information-schema-slow-query.md +++ b/information-schema/information-schema-slow-query.md @@ -106,6 +106,9 @@ The output is as follows: 74 rows in set (0.001 sec) ``` +The maximum statement length of the `Query` column is limited by the [`tidb_stmt_summary_max_sql_length`](/system-variables.md#tidb_stmt_summary_max_sql_length-new-in-v40) system variable. + + ## CLUSTER_SLOW_QUERY table The `CLUSTER_SLOW_QUERY` table provides the slow query information of all nodes in the cluster, which is the parsing result of the TiDB slow log files. You can use the `CLUSTER_SLOW_QUERY` table the way you do with `SLOW_QUERY`. The table schema of the `CLUSTER_SLOW_QUERY` table differs from that of the `SLOW_QUERY` table in that an `INSTANCE` column is added to `CLUSTER_SLOW_QUERY`. The `INSTANCE` column represents the TiDB node address of the row information on the slow query. @@ -222,9 +225,9 @@ The output is as follows: | id | estRows | task | access object | operator info | +----------------------------+----------+-----------+--------------------------+------------------------------------------------------+ | StreamAgg_7 | 1.00 | root | | funcs:count(1)->Column#75 | -| └─TableReader_13 | 10.00 | root | | data:Selection_12 | -| └─Selection_12 | 10.00 | cop[tidb] | | eq(INFORMATION_SCHEMA.cluster_slow_query.user, "u1") | -| └─TableFullScan_11 | 10000.00 | cop[tidb] | table:CLUSTER_SLOW_QUERY | keep order:false, stats:pseudo | +| └─TableReader_13 | 10.00 | root | | data:Selection_12 | +| └─Selection_12 | 10.00 | cop[tidb] | | eq(INFORMATION_SCHEMA.cluster_slow_query.user, "u1") | +| └─TableFullScan_11 | 10000.00 | cop[tidb] | table:CLUSTER_SLOW_QUERY | keep order:false, stats:pseudo | +----------------------------+----------+-----------+--------------------------+------------------------------------------------------+ 4 rows in set (0.00 sec) ``` @@ -235,4 +238,4 @@ Currently, because statistics of the system tables are not collected, sometimes ```sql SELECT /*+ AGG_TO_COP() */ COUNT(*) FROM CLUSTER_SLOW_QUERY GROUP BY user; -``` +``` \ No newline at end of file diff --git a/system-variables.md b/system-variables.md index d28900c8140a2..041b838485ef5 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5230,7 +5230,7 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md). - Type: Integer - Default value: `4096` - Range: `[0, 2147483647]` -- This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md). +- This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md), the [SLOW_QUERY](/information-schema/information-schema-slow-query.md) table and on the [TiDB Dashboard](/dashboard/dashboard-intro.md). ### tidb_stmt_summary_max_stmt_count New in v4.0 From 5215938a1db278473f68034148f95bb39038c8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 5 Dec 2023 17:41:16 +0100 Subject: [PATCH 2/8] Update with TiDB/Cloud differences --- system-variables.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/system-variables.md b/system-variables.md index 041b838485ef5..9cd6f15693448 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5230,7 +5230,14 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md). - Type: Integer - Default value: `4096` - Range: `[0, 2147483647]` + + - This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md), the [SLOW_QUERY](/information-schema/information-schema-slow-query.md) table and on the [TiDB Dashboard](/dashboard/dashboard-intro.md). + + + +- This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md) and the [SLOW_QUERY](/information-schema/information-schema-slow-query.md) table. + ### tidb_stmt_summary_max_stmt_count New in v4.0 From 109a32f7a8eb28ba80b4f76a3be6aa35886bf201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 5 Dec 2023 17:42:52 +0100 Subject: [PATCH 3/8] Fix MD012 --- information-schema/information-schema-slow-query.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/information-schema/information-schema-slow-query.md b/information-schema/information-schema-slow-query.md index ee65dbf8cb322..9678b20f6a25c 100644 --- a/information-schema/information-schema-slow-query.md +++ b/information-schema/information-schema-slow-query.md @@ -108,7 +108,6 @@ The output is as follows: The maximum statement length of the `Query` column is limited by the [`tidb_stmt_summary_max_sql_length`](/system-variables.md#tidb_stmt_summary_max_sql_length-new-in-v40) system variable. - ## CLUSTER_SLOW_QUERY table The `CLUSTER_SLOW_QUERY` table provides the slow query information of all nodes in the cluster, which is the parsing result of the TiDB slow log files. You can use the `CLUSTER_SLOW_QUERY` table the way you do with `SLOW_QUERY`. The table schema of the `CLUSTER_SLOW_QUERY` table differs from that of the `SLOW_QUERY` table in that an `INSTANCE` column is added to `CLUSTER_SLOW_QUERY`. The `INSTANCE` column represents the TiDB node address of the row information on the slow query. @@ -238,4 +237,4 @@ Currently, because statistics of the system tables are not collected, sometimes ```sql SELECT /*+ AGG_TO_COP() */ COUNT(*) FROM CLUSTER_SLOW_QUERY GROUP BY user; -``` \ No newline at end of file +``` From 384c08c56b7c99b456bdcd3704cccad1b0d4d230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Thu, 14 Dec 2023 10:02:44 +0100 Subject: [PATCH 4/8] Update system-variables.md Co-authored-by: xixirangrang --- system-variables.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system-variables.md b/system-variables.md index 9cd6f15693448..5de657bb0cefc 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5233,10 +5233,13 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md). - This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md), the [SLOW_QUERY](/information-schema/information-schema-slow-query.md) table and on the [TiDB Dashboard](/dashboard/dashboard-intro.md). + + - This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md) and the [SLOW_QUERY](/information-schema/information-schema-slow-query.md) table. + ### tidb_stmt_summary_max_stmt_count New in v4.0 From 38c5b0bef5f532fafa39de8f27aa0f5d0570ca14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Thu, 14 Dec 2023 15:56:27 +0100 Subject: [PATCH 5/8] Update dashboard/dashboard-slow-query.md --- dashboard/dashboard-slow-query.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/dashboard-slow-query.md b/dashboard/dashboard-slow-query.md index d03ce4f386595..bca7459101a2c 100644 --- a/dashboard/dashboard-slow-query.md +++ b/dashboard/dashboard-slow-query.md @@ -62,7 +62,7 @@ Click any item in the list to display detailed execution information of the slow > **Note:** > -> The maximum length of the query is limited by the [`tidb_stmt_summary_max_sql_length`](/system-variables.md#tidb_stmt_summary_max_sql_length-new-in-v40) system variable. +> The maximum length of the query recorded in the `Query` column is limited by the [`tidb_stmt_summary_max_sql_length`](/system-variables.md#tidb_stmt_summary_max_sql_length-new-in-v40) system variable. Click the **Expand** button to view the detailed information of an item. Click the **Copy** button to copy the detailed information to the clipboard. From 3d5202b3b312c3fccd0c97293d7e340f664af2a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Thu, 14 Dec 2023 15:58:55 +0100 Subject: [PATCH 6/8] Update system-variables.md Co-authored-by: xixirangrang --- system-variables.md | 1 + 1 file changed, 1 insertion(+) diff --git a/system-variables.md b/system-variables.md index 5de657bb0cefc..b18d19cc9ad58 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5232,6 +5232,7 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md). - Range: `[0, 2147483647]` + - This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md), the [SLOW_QUERY](/information-schema/information-schema-slow-query.md) table and on the [TiDB Dashboard](/dashboard/dashboard-intro.md). From 18bf6005bda5e3363c5f04fda5e8f99eb5c19fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 19 Dec 2023 11:07:51 +0100 Subject: [PATCH 7/8] Update system-variables.md Co-authored-by: Grace Cai --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index b18d19cc9ad58..2291decce56da 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5233,7 +5233,7 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md). -- This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md), the [SLOW_QUERY](/information-schema/information-schema-slow-query.md) table and on the [TiDB Dashboard](/dashboard/dashboard-intro.md). +- This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md), the [`SLOW_QUERY`](/information-schema/information-schema-slow-query.md) table, and the [TiDB Dashboard](/dashboard/dashboard-intro.md). From 447d92ae99d3c9b97ddc9a6592b6c338a8dfbfc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 19 Dec 2023 15:53:42 +0100 Subject: [PATCH 8/8] Update system-variables.md Co-authored-by: Grace Cai --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 2291decce56da..e834609bdcce3 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5239,7 +5239,7 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md). -- This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md) and the [SLOW_QUERY](/information-schema/information-schema-slow-query.md) table. +- This variable is used to control the length of the SQL string in [statement summary tables](/statement-summary-tables.md) and the [`SLOW_QUERY`](/information-schema/information-schema-slow-query.md) table.