From 1f1486c6d3c8e41833eb7d2ed8452f0d093d5d2b Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Fri, 23 Jul 2021 15:14:14 +0800 Subject: [PATCH 1/5] This is an automated cherry-pick of #6021 Signed-off-by: ti-chi-bot --- sql-statements/sql-statement-show-variables.md | 2 +- statement-summary-tables.md | 2 +- system-variables.md | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sql-statements/sql-statement-show-variables.md b/sql-statements/sql-statement-show-variables.md index df3237ed7bb9..6a8120d4d8f6 100644 --- a/sql-statements/sql-statement-show-variables.md +++ b/sql-statements/sql-statement-show-variables.md @@ -130,7 +130,7 @@ mysql> SHOW GLOBAL VARIABLES LIKE 'tidb%'; | tidb_stmt_summary_history_size | 24 | | tidb_stmt_summary_internal_query | 0 | | tidb_stmt_summary_max_sql_length | 4096 | -| tidb_stmt_summary_max_stmt_count | 200 | +| tidb_stmt_summary_max_stmt_count | 3000 | | tidb_stmt_summary_refresh_interval | 1800 | | tidb_store_limit | 0 | | tidb_txn_mode | | diff --git a/statement-summary-tables.md b/statement-summary-tables.md index a0ac5c7e3add..98ff511f7bc7 100644 --- a/statement-summary-tables.md +++ b/statement-summary-tables.md @@ -102,7 +102,7 @@ The following system variables are used to control the statement summary: - `tidb_enable_stmt_summary`: Determines whether to enable the statement summary feature. `1` represents `enable`, and `0` means `disable`. The feature is enabled by default. The statistics in the system table are cleared if this feature is disabled. The statistics are re-calculated next time this feature is enabled. Tests have shown that enabling this feature has little impact on performance. - `tidb_stmt_summary_refresh_interval`: The interval at which the `statements_summary` table is refreshed. The time unit is second (s). The default value is `1800`. - `tidb_stmt_summary_history_size`: The size of each SQL statement category stored in the `statements_summary_history` table. The default value is `24`. -- `tidb_stmt_summary_max_stmt_count`: Limits the number of SQL statements that can be stored in statement summary tables. The default value is `200`. If the limit is exceeded, those SQL statements that recently remain unused are cleared. +- `tidb_stmt_summary_max_stmt_count`: Limits the number of SQL statements that can be stored in statement summary tables. Before v4.0.14, the default value is `200`. Since v4.0.14, the default value is `3000`. If the limit is exceeded, those SQL statements that recently remain unused are cleared. - `tidb_stmt_summary_max_sql_length`: Specifies the longest display length of `DIGEST_TEXT` and `QUERY_SAMPLE_TEXT`. The default value is `4096`. - `tidb_stmt_summary_internal_query`: Determines whether to count the TiDB SQL statements. `1` means to count, and `0` means not to count. The default value is `0`. diff --git a/system-variables.md b/system-variables.md index 40d2933076cd..e49292f4be17 100644 --- a/system-variables.md +++ b/system-variables.md @@ -1269,8 +1269,12 @@ SET tidb_slow_log_threshold = 200; ### tidb_stmt_summary_max_stmt_count New in v4.0 - Scope: SESSION | GLOBAL +<<<<<<< HEAD - Default value: `200` - Range: `[1, 32767]` +======= +- Default value: Before v4.0.14, the default value is 200. Since v4.0.14, the default value is 3000 (the value of the default configuration file). +>>>>>>> 53b1093d6 (Update the default value of tidb_stmt_summary_max_stmt_count (#6021)) - This variable is used to set the maximum number of statements that the statement summary stores in memory. ### tidb_stmt_summary_refresh_interval New in v4.0 From 6534564a43829a1c981805a0149dd043abf665a1 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Fri, 23 Jul 2021 15:17:38 +0800 Subject: [PATCH 2/5] Update statement-summary-tables.md --- statement-summary-tables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statement-summary-tables.md b/statement-summary-tables.md index 98ff511f7bc7..740869a12425 100644 --- a/statement-summary-tables.md +++ b/statement-summary-tables.md @@ -102,7 +102,7 @@ The following system variables are used to control the statement summary: - `tidb_enable_stmt_summary`: Determines whether to enable the statement summary feature. `1` represents `enable`, and `0` means `disable`. The feature is enabled by default. The statistics in the system table are cleared if this feature is disabled. The statistics are re-calculated next time this feature is enabled. Tests have shown that enabling this feature has little impact on performance. - `tidb_stmt_summary_refresh_interval`: The interval at which the `statements_summary` table is refreshed. The time unit is second (s). The default value is `1800`. - `tidb_stmt_summary_history_size`: The size of each SQL statement category stored in the `statements_summary_history` table. The default value is `24`. -- `tidb_stmt_summary_max_stmt_count`: Limits the number of SQL statements that can be stored in statement summary tables. Before v4.0.14, the default value is `200`. Since v4.0.14, the default value is `3000`. If the limit is exceeded, those SQL statements that recently remain unused are cleared. +- `tidb_stmt_summary_max_stmt_count`: Limits the number of SQL statements that can be stored in statement summary tables. The default value is `3000`. If the limit is exceeded, those SQL statements that recently remain unused are cleared. - `tidb_stmt_summary_max_sql_length`: Specifies the longest display length of `DIGEST_TEXT` and `QUERY_SAMPLE_TEXT`. The default value is `4096`. - `tidb_stmt_summary_internal_query`: Determines whether to count the TiDB SQL statements. `1` means to count, and `0` means not to count. The default value is `0`. From 8775da94d904a198dac146d30bf7962b056b62de Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Fri, 23 Jul 2021 15:19:21 +0800 Subject: [PATCH 3/5] Apply suggestions from code review --- system-variables.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/system-variables.md b/system-variables.md index e49292f4be17..40d2933076cd 100644 --- a/system-variables.md +++ b/system-variables.md @@ -1269,12 +1269,8 @@ SET tidb_slow_log_threshold = 200; ### tidb_stmt_summary_max_stmt_count New in v4.0 - Scope: SESSION | GLOBAL -<<<<<<< HEAD - Default value: `200` - Range: `[1, 32767]` -======= -- Default value: Before v4.0.14, the default value is 200. Since v4.0.14, the default value is 3000 (the value of the default configuration file). ->>>>>>> 53b1093d6 (Update the default value of tidb_stmt_summary_max_stmt_count (#6021)) - This variable is used to set the maximum number of statements that the statement summary stores in memory. ### tidb_stmt_summary_refresh_interval New in v4.0 From f7cd8ced64456b620f40c2c7e25dd62bc532948b Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Fri, 23 Jul 2021 15:20:40 +0800 Subject: [PATCH 4/5] Update system-variables.md --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 40d2933076cd..b133f27be48c 100644 --- a/system-variables.md +++ b/system-variables.md @@ -1269,7 +1269,7 @@ SET tidb_slow_log_threshold = 200; ### tidb_stmt_summary_max_stmt_count New in v4.0 - Scope: SESSION | GLOBAL -- Default value: `200` +- Default value: `300` - Range: `[1, 32767]` - This variable is used to set the maximum number of statements that the statement summary stores in memory. From 8e5d06fa34213e8344c2c92951fc307dd0a5aa5e Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Fri, 23 Jul 2021 15:20:56 +0800 Subject: [PATCH 5/5] Update system-variables.md --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index b133f27be48c..2ffbc8f0052c 100644 --- a/system-variables.md +++ b/system-variables.md @@ -1269,7 +1269,7 @@ SET tidb_slow_log_threshold = 200; ### tidb_stmt_summary_max_stmt_count New in v4.0 - Scope: SESSION | GLOBAL -- Default value: `300` +- Default value: `3000` - Range: `[1, 32767]` - This variable is used to set the maximum number of statements that the statement summary stores in memory.