From 1ccc6638a790bd6a551fc76a4d6708dec9b833b9 Mon Sep 17 00:00:00 2001
From: TomShawn <41534398+TomShawn@users.noreply.github.com>
Date: Tue, 12 Jan 2021 18:46:03 +0800
Subject: [PATCH 1/2] Add doc for tidb_executor_concurrency
---
system-variables.md | 71 ++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 64 insertions(+), 7 deletions(-)
diff --git a/system-variables.md b/system-variables.md
index e8619ab644a4c..f1fc81f841017 100644
--- a/system-variables.md
+++ b/system-variables.md
@@ -455,21 +455,33 @@ Constraint checking is always performed in place for pessimistic transactions (d
### tidb_hash_join_concurrency
+> **Warning:**
+>
+> Since v5.0.0-rc, this variable is deprecated. Instead, use [`tidb_executor_concurrency`](#tidb_executor_concurrency-new-in-v500-rc) for setting.
+
- Scope: SESSION | GLOBAL
-- Default value: 5
+- Default value: -1
- This variable is used to set the concurrency of the `hash join` algorithm.
### tidb_hashagg_final_concurrency
+> **Warning:**
+>
+> Since v5.0.0-rc, this variable is deprecated. Instead, use [`tidb_executor_concurrency`](#tidb_executor_concurrency-new-in-v500-rc) for setting.
+
- Scope: SESSION | GLOBAL
-- Default value: 4
+- Default value: -1
- This variable is used to set the concurrency of executing the concurrent `hash aggregation` algorithm in the `final` phase.
- When the parameter of the aggregate function is not distinct, `HashAgg` is run concurrently and respectively in two phases - the `partial` phase and the `final` phase.
### tidb_hashagg_partial_concurrency
+> **Warning:**
+>
+> Since v5.0.0-rc, this variable is deprecated. Instead, use [`tidb_executor_concurrency`](#tidb_executor_concurrency-new-in-v500-rc) for setting.
+
- Scope: SESSION | GLOBAL
-- Default value: 4
+- Default value: -1
- This variable is used to set the concurrency of executing the concurrent `hash aggregation` algorithm in the `partial` phase.
- When the parameter of the aggregate function is not distinct, `HashAgg` is run concurrently and respectively in two phases - the `partial` phase and the `final` phase.
@@ -482,15 +494,23 @@ Constraint checking is always performed in place for pessimistic transactions (d
### tidb_index_lookup_concurrency
+> **Warning:**
+>
+> Since v5.0.0-rc, this variable is deprecated. Instead, use [`tidb_executor_concurrency`](#tidb_executor_concurrency-new-in-v500-rc) for setting.
+
- Scope: SESSION | GLOBAL
-- Default value: 4
+- Default value: -1
- This variable is used to set the concurrency of the `index lookup` operation.
- Use a bigger value in OLAP scenarios, and a smaller value in OLTP scenarios.
### tidb_index_lookup_join_concurrency
+> **Warning:**
+>
+> Since v5.0.0-rc, this variable is deprecated. Instead, use [`tidb_executor_concurrency`](#tidb_executor_concurrency-new-in-v500-rc) for setting.
+
- Scope: SESSION | GLOBAL
-- Default value: 4
+- Default value: -1
- This variable is used to set the concurrency of the `index lookup join` algorithm.
### tidb_index_lookup_size
@@ -500,6 +520,35 @@ Constraint checking is always performed in place for pessimistic transactions (d
- This variable is used to set the batch size of the `index lookup` operation.
- Use a bigger value in OLAP scenarios, and a smaller value in OLTP scenarios.
+### `tidb_executor_concurrency` New in v5.0.0-rc
+
+Scope: SESSION | GLOBAL
+
+Default value: 5
+
+This variable is used to set the concurrency of the following SQL operators (to one value):
+
+- `index lookup`
+- `index lookup join`
+- `hash join`
+- `hash aggregation` (the `partial` and `final` phases)
+- `window`
+- `projection`
+
+`tidb_executor_concurrency` integrates the following existing system variables for easier management:
+
++ `tidb_index_lookup_concurrency`
++ `tidb_index_lookup_join_concurrency`
++ `tidb_hash_join_concurrency`
++ `tidb_hashagg_partial_concurrency`
++ `tidb_hashagg_final_concurrency`
++ `tidb_projection_concurrency`
++ `tidb_window_concurrency`
+
+Since v5.0.0-rc, you can still separately modify the system variables listed above (with a deprecation warning returned) and your modification only affects the corresponding single operators. After that, if you use `tidb_executor_concurrency` to modify the operator concurrency, the separately modified operators will not be affected. If you want to use `tidb_executor_concurrency` to modify the concurrency of all operators, you can set the values of all variables listed above to `-1`.
+
+For a system upgraded to v5.0.0-rc from an earlier version, if you have not modified any value of the variables listed above (which means that the `tidb_hash_join_concurrency` value is `5` and the values of the rest are `4`), the operator concurrency previously managed by these variables will automatically be managed by `tidb_executor_concurrency`. If you have modified any of these variables, the concurrency of the corresponding operators will still be controlled by the modified variables.
+
### tidb_index_serial_scan_concurrency
- Scope: SESSION | GLOBAL
@@ -648,8 +697,12 @@ mysql> desc select count(distinct a) from test.t;
### tidb_projection_concurrency
+> **Warning:**
+>
+> Since v5.0.0-rc, this variable is deprecated. Instead, use [`tidb_executor_concurrency`](#tidb_executor_concurrency-new-in-v500-rc) for setting.
+
- Scope: SESSION | GLOBAL
-- Default value: 4
+- Default value: -1
- This variable is used to set the concurrency of the `Projection` operator.
### tidb_query_log_max_len
@@ -831,8 +884,12 @@ SET tidb_slow_log_threshold = 200;
### tidb_window_concurrency New in v4.0
+> **Warning:**
+>
+> Since v5.0.0-rc, this variable is deprecated. Instead, use [`tidb_executor_concurrency`](#tidb_executor_concurrency-new-in-v500-rc) for setting.
+
- Scope: SESSION | GLOBAL
-- Default value: 4
+- Default value: -1
- This variable is used to set the concurrency degree of the window operator.
### time_zone
From 66645d28d735ac78317ab22c5d30f2ff468933cc Mon Sep 17 00:00:00 2001
From: TomShawn <41534398+TomShawn@users.noreply.github.com>
Date: Tue, 12 Jan 2021 19:16:47 +0800
Subject: [PATCH 2/2] Apply suggestions from code review
Co-authored-by: Ran
---
system-variables.md | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/system-variables.md b/system-variables.md
index f1fc81f841017..1ef838c6e4558 100644
--- a/system-variables.md
+++ b/system-variables.md
@@ -522,9 +522,8 @@ Constraint checking is always performed in place for pessimistic transactions (d
### `tidb_executor_concurrency` New in v5.0.0-rc
-Scope: SESSION | GLOBAL
-
-Default value: 5
+- Scope: SESSION | GLOBAL
+- Default value: 5
This variable is used to set the concurrency of the following SQL operators (to one value):
@@ -535,7 +534,7 @@ This variable is used to set the concurrency of the following SQL operators (to
- `window`
- `projection`
-`tidb_executor_concurrency` integrates the following existing system variables for easier management:
+`tidb_executor_concurrency` incorporates the following existing system variables as a whole for easier management:
+ `tidb_index_lookup_concurrency`
+ `tidb_index_lookup_join_concurrency`