From 56142de0c8c9c73fdf85a3184cabe53cf731815c Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Mon, 23 Aug 2021 11:29:09 -0600 Subject: [PATCH 1/3] Update system variables for correctness --- system-variables.md | 56 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/system-variables.md b/system-variables.md index 65f963bb2c8e7..35cd8bb0832a4 100644 --- a/system-variables.md +++ b/system-variables.md @@ -128,19 +128,20 @@ mysql> SELECT * FROM t1; - This variable indicates the location where data is stored. This location can be a local path or point to a PD server if the data is stored on TiKV. - A value in the format of `ip_address:port` indicates the PD server that TiDB connects to on startup. +### ddl_slow_threshold + +- Scope: INSTANCE +- Default value: `300` +- DDL operations whose execution time exceeds the threshold value are output to the log. The unit is millisecond. + ### default_authentication_plugin - Scope: GLOBAL - Default value: `mysql_native_password` +- Possible values: `mysql_native_password`, `caching_sha2_password` - This variable sets the authentication method that the server advertises when the server-client connection is being established. Possible values for this variable are documented in [Authentication plugin status](/security-compatibility-with-mysql.md#authentication-plugin-status). - Value options: `mysql_native_password` and `caching_sha2_password`. For more details, see [Authentication plugin status](/security-compatibility-with-mysql.md#authentication-plugin-status). -### ddl_slow_threshold - -- Scope: INSTANCE -- Default value: `300` -- DDL operations whose execution time exceeds the threshold value are output to the log. The unit is millisecond. - ### foreign_key_checks - Scope: SESSION | GLOBAL @@ -189,7 +190,7 @@ mysql> SELECT * FROM t1; ### license - Scope: NONE -- Default value: Apache License 2.0 +- Default value: `Apache License 2.0` - This variable indicates the license of your TiDB server installation. ### max_execution_time @@ -269,11 +270,11 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a - Default value: `OFF` - This variable is used to set whether the `AUTO_INCREMENT` property of a column is allowed to be removed by executing `ALTER TABLE MODIFY` or `ALTER TABLE CHANGE` statements. It is not allowed by default. -### tidb_analyze_version New in v5.1.0 +### tidb_analyze_version New in v5.1 - Scope: SESSION | GLOBAL -- Value options: `1` and `2` - Default value: `2` +- Range: `[1, 2]` - Controls how TiDB collects statistics. - In versions before v5.1.0, the default value of this variable is `1`. In v5.1.0, the default value of this variable is `2`, which serves as an experimental feature. For detailed introduction, see [Introduction to Statistics](/statistics.md). @@ -321,14 +322,14 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a - Scope: SESSION | GLOBAL - Default value: `10240` -- Range: `[-1, 9223372036854775807]` +- Range: `[0, 9223372036854775807]` - The unit of the variable is rows. If the objects of the join operation belong to a subquery, the optimizer cannot estimate the size of the subquery result set. In this situation, the size is determined by the number of rows in the result set. If the estimated number of rows in the subquery is less than the value of this variable, the Broadcast Hash Join algorithm is used. Otherwise, the Shuffled Hash Join algorithm is used. When `tidb_broadcast_join_threshold_count = -1`, the threshold is infinitely high. ### tidb_broadcast_join_threshold_size New in v5.0 - Scope: SESSION | GLOBAL - Default value: `104857600` (100 MiB) -- Range: `[-1, 9223372036854775807]` +- Range: `[0, 9223372036854775807]` - Unit: Bytes - If the table size is less than the value of the variable, the Broadcast Hash Join algorithm is used. Otherwise, the Shuffled Hash Join algorithm is used. When `tidb_broadcast_join_threshold_size = -1`, the threshold is infinitely high. @@ -565,7 +566,7 @@ Constraint checking is always performed in place for pessimistic transactions (d > > Currently, List partition and List COLUMNS partition are experimental features. It is not recommended that you use it in the production environment. -- Scope: SESSION +- Scope: SESSION | GLOBAL - Default value: `OFF` - This variable is used to set whether to enable the `LIST (COLUMNS) TABLE PARTITION` feature. @@ -667,7 +668,8 @@ Query OK, 0 rows affected (0.09 sec) ### tidb_enforce_mpp New in v5.1 - Scope: SESSION -- Default value: `OFF`. To change this default value, modify the [`performance.enforce-mpp`](/tidb-configuration-file.md#enforce-mpp) configuration value. +- Default value: `OFF` +- To change this default value, modify the [`performance.enforce-mpp`](/tidb-configuration-file.md#enforce-mpp) configuration value. - Controls whether to ignore the optimizer's cost estimation and to forcibly use TiFlash's MPP mode for query execution. The value options are as follows: - `0` or `OFF`, which means that the MPP mode is not forcibly used (by default). - `1` or `ON`, which means that the cost estimation is ignored and the MPP mode is forcibly used. Note that this setting only takes effect when `tidb_allow_mpp=true`. @@ -1002,20 +1004,6 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified - This variable is used to set whether the optimizer executes the optimization operation of pushing down the aggregate function to the position before Join, Projection, and UnionAll. - When the aggregate operation is slow in query, you can set the variable value to ON. -### tidb_opt_limit_push_down_threshold - -- Scope: SESSION | GLOBAL -- Default value: `100` -- Range: `[0, 2147483647]` -- This variable is used to set the threshold that determines whether to push the Limit or TopN operator down to TiKV. -- If the value of the Limit or TopN operator is smaller than or equal to this threshold, these operators are forcibly pushed down to TiKV. This variable resolves the issue that the Limit or TopN operator cannot be pushed down to TiKV partly due to wrong estimation. - -### tidb_opt_enable_correlation_adjustment - -- Scope: SESSION | GLOBAL -- Default value: `ON` -- This variable is used to control whether the optimizer estimates the number of rows based on column order correlation - ### tidb_opt_correlation_exp_factor - Scope: SESSION | GLOBAL @@ -1068,6 +1056,12 @@ mysql> desc select count(distinct a) from test.t; 4 rows in set (0.00 sec) ``` +### tidb_opt_enable_correlation_adjustment + +- Scope: SESSION | GLOBAL +- Default value: `ON` +- This variable is used to control whether the optimizer estimates the number of rows based on column order correlation + ### tidb_opt_insubq_to_join_and_agg - Scope: SESSION | GLOBAL @@ -1091,6 +1085,14 @@ mysql> desc select count(distinct a) from test.t; select * from t, t1 where t.a=t1.a ``` +### tidb_opt_limit_push_down_threshold + +- Scope: SESSION | GLOBAL +- Default value: `100` +- Range: `[0, 2147483647]` +- This variable is used to set the threshold that determines whether to push the Limit or TopN operator down to TiKV. +- If the value of the Limit or TopN operator is smaller than or equal to this threshold, these operators are forcibly pushed down to TiKV. This variable resolves the issue that the Limit or TopN operator cannot be pushed down to TiKV partly due to wrong estimation. + ### tidb_opt_prefer_range_scan New in v5.0 - Scope: SESSION From 5122ecae9fd49cda6594ef83d95ff5b9df123692 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Mon, 23 Aug 2021 13:04:13 -0600 Subject: [PATCH 2/3] fix broken anchor --- releases/release-5.1.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releases/release-5.1.0.md b/releases/release-5.1.0.md index 045a10b9451f3..4076b189fd56a 100644 --- a/releases/release-5.1.0.md +++ b/releases/release-5.1.0.md @@ -30,7 +30,7 @@ In v5.1, the key new features or improvements are as follows: |:----------|:-----------|:-----------| | [`cte_max_recursion_depth`](/system-variables.md#cte_max_recursion_depth) | Newly added | Controls the maximum recursion depth in Common Table Expressions. | | [`init_connect`](/system-variables.md#init_connect) | Newly added | Controls the initial connection to a TiDB server. | -| [`tidb_analyze_version`](/system-variables.md#tidb_analyze_version-new-in-v510) | Newly added | Controls how TiDB collects statistics. The default value of this variable is `2`. This is an experimental feature. | +| [`tidb_analyze_version`](/system-variables.md#tidb_analyze_version-new-in-v51) | Newly added | Controls how TiDB collects statistics. The default value of this variable is `2`. This is an experimental feature. | | [`tidb_enable_enhanced_security`](/system-variables.md#tidb_enable_enhanced_security) | Newly added | Indicates whether the TiDB server you are connected to has the Security Enhanced Mode (SEM) enabled. This variable setting cannot be changed without restarting the TiDB server. | | [`tidb_enforce_mpp`](/system-variables.md#tidb_enforce_mpp-new-in-v51) | Newly added | Controls whether to ignore the optimizer's cost estimation and to forcibly use the MPP mode for query execution. The data type of this variable is `BOOL` and the default value is `false`. | | [`tidb_partition_prune_mode`](/system-variables.md#tidb_partition_prune_mode-new-in-v51) | Newly added | Specifies whether to enable dynamic pruning mode for partitioned tables. This feature is experimental. The default value of this variable is `static`, which means the dynamic pruning mode for partitioned tables is disabled by default. | From 404a1942cd29087668d7ce8f535276881723c51a Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Tue, 24 Aug 2021 10:09:24 -0600 Subject: [PATCH 3/3] Update system-variables.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 35cd8bb0832a4..0df2d9a996483 100644 --- a/system-variables.md +++ b/system-variables.md @@ -270,7 +270,7 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a - Default value: `OFF` - This variable is used to set whether the `AUTO_INCREMENT` property of a column is allowed to be removed by executing `ALTER TABLE MODIFY` or `ALTER TABLE CHANGE` statements. It is not allowed by default. -### tidb_analyze_version New in v5.1 +### tidb_analyze_version New in v5.1.0 - Scope: SESSION | GLOBAL - Default value: `2`