You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: statistics.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -763,23 +763,29 @@ The relationships of the relevant system variables are shown below:
763
763
764
764
#### `tidb_build_stats_concurrency`
765
765
766
-
When you run the `ANALYZE` statement, the task is divided into multiple small tasks. Each task only works on statistics of one column orindex. You can use the [`tidb_build_stats_concurrency`](/system-variables.md#tidb_build_stats_concurrency) variable to control the number of simultaneous small tasks. The default value is `2`. The default value is `4` for v7.4.0 and earlier versions.
766
+
This variable controls the concurrency for building statistics during manual `ANALYZE`, such as the numberof table orpartition analysis tasks that can be processed simultaneously. The default value is `2`. The default value is `4` for v7.4.0and earlier versions.
767
767
768
768
#### `tidb_build_sampling_stats_concurrency`
769
769
770
-
When analyzing ordinary columns, you can use [`tidb_build_sampling_stats_concurrency`](/system-variables.md#tidb_build_sampling_stats_concurrency-new-in-v750) to control the concurrency of executing sampling tasks. The default value is `2`.
770
+
This variable controls the following aspects of `ANALYZE` concurrency:
771
+
772
+
- The concurrency for merging samples collected from different Regions.
773
+
- The concurrency for collecting statistics on special indexes (such as indexes on generated virtual columns), for example, the number of indexes that TiDB can concurrently collect statistics for.
774
+
775
+
The default value is `2`.
771
776
772
777
#### `tidb_analyze_partition_concurrency`
773
778
774
-
When running the `ANALYZE` statement, you can use [`tidb_analyze_partition_concurrency`](/system-variables.md#tidb_analyze_partition_concurrency) to control the concurrency of reading and writing statistics for a partitioned table. The default value is `2`. The default value is `1` for v7.4.0 and earlier versions.
779
+
This variable controls the concurrency for saving `ANALYZE` results (writing TopN andhistograms to system tables). The default value is `2`. The default value is `1` for v7.4.0and earlier versions.
775
780
776
-
#### `tidb_distsql_scan_concurrency`
781
+
#### `tidb_analyze_distsql_scan_concurrency`
777
782
778
-
When you analyze regular columns, you can use the [`tidb_distsql_scan_concurrency`](/system-variables.md#tidb_distsql_scan_concurrency) variable to control the number of Regions to be read at one time. The default value is `15`. Note that changing the value will affect query performance. Adjust the value carefully.
783
+
This variable controls the following aspects of `ANALYZE` concurrency:
779
784
780
-
#### `tidb_index_serial_scan_concurrency`
785
+
- The concurrency of scanning TiKV Regions.
786
+
- The concurrency of scanning Regions for special indexes (indexes generated from virtual columns).
781
787
782
-
When you analyze index columns, you can use the [`tidb_index_serial_scan_concurrency`](/system-variables.md#tidb_index_serial_scan_concurrency) variable to control the number of Regions to be read at one time. The default value is `1`. Note that changing the value will affect query performance. Adjust the value carefully.
Copy file name to clipboardExpand all lines: system-variables.md
+20-10Lines changed: 20 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1114,21 +1114,28 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a
1114
1114
1115
1115
### tidb_analyze_distsql_scan_concurrency <span class="version-mark">New in v7.6.0</span>
1116
1116
1117
+
> **Note:**
1118
+
>
1119
+
> In versions earlier than v7.6.0, regular `ANALYZE` region scans are controlled by `tidb_distsql_scan_concurrency`, and index statistics scans are controlled by `tidb_index_serial_scan_concurrency`. Therefore, to adjust the concurrency of scanning TiKV Regions for these versions, consider changing the value of `tidb_distsql_scan_concurrency`.
1120
+
1117
1121
- Scope: SESSION | GLOBAL
1118
1122
- Persists to cluster: Yes
1119
1123
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
1120
1124
- Type: Integer
1121
1125
- Default value: `4`
1122
1126
- Range: `[1, 4294967295]`
1123
-
- This variable is used to set the concurrency of the `scan` operation when executing the `ANALYZE` operation.
1127
+
- This variable controls the following aspects of `ANALYZE` concurrency:
1128
+
- The concurrency of scanning TiKV Regions.
1129
+
- The concurrency of scanning Regions for special indexes, such as indexes on generated virtual columns.
1124
1130
1125
1131
### tidb_analyze_partition_concurrency
1126
1132
1127
1133
- Scope: SESSION | GLOBAL
1128
1134
- Persists to cluster: Yes
1129
1135
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
1130
1136
- Default value: `2`. The default value is `1` for v7.4.0 and earlier versions.
1131
-
- This variable specifies the concurrency of reading and writing statistics for a partitioned table when TiDB analyzes the partitioned table.
1137
+
- Range: `[1, 18446744073709551615]`
1138
+
- For manual and auto `ANALYZE`, this variable controls the concurrency for saving `ANALYZE` results, including writing TopN and histograms to system tables.
1132
1139
1133
1140
### tidb_analyze_version <span class="version-mark">New in v5.1.0</span>
1134
1141
@@ -1250,7 +1257,7 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
1250
1257
- Type: Integer
1251
1258
- Default value: `1`
1252
1259
- Range: `[1, 256]`
1253
-
- This variable is used to set the concurrency of executing the automatic update of statistics.
1260
+
- This variable controls the concurrency for building statistics during auto `ANALYZE`, such as the number of table or partition analysis tasks that can be processed simultaneously.
1254
1261
1255
1262
### tidb_backoff_lock_fast
1256
1263
@@ -1355,8 +1362,7 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
1355
1362
- Default value: `2`. The default value is `4` for v7.4.0 and earlier versions.
1356
1363
- Range: `[1, 256]`
1357
1364
- Unit: Threads
1358
-
- This variable is used to set the concurrency of executing the `ANALYZE` statement.
1359
-
- When the variable is set to a larger value, the execution performance of other queries is affected.
1365
+
- This variable controls the concurrency for building statistics during manual `ANALYZE`, such as the number of table or partition analysis tasks that can be processed simultaneously.
1360
1366
1361
1367
### tidb_build_sampling_stats_concurrency <spanclass="version-mark">New in v7.5.0</span>
1362
1368
@@ -1367,8 +1373,9 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
1367
1373
- Unit: Threads
1368
1374
- Default value: `2`
1369
1375
- Range: `[1, 256]`
1370
-
- This variable is used to set the sampling concurrency in the `ANALYZE` process.
1371
-
- When the variable is set to a larger value, the execution performance of other queries is affected.
1376
+
- This variable controls the following aspects of `ANALYZE` concurrency:
1377
+
- The concurrency for merging samples collected from different Regions.
1378
+
- The concurrency for collecting statistics on special indexes (such as indexes on generated virtual columns), for example, the number of indexes that TiDB can concurrently collect statistics for.
1372
1379
1373
1380
### tidb_capture_plan_baselines <spanclass="version-mark">New in v4.0</span>
1374
1381
@@ -3339,15 +3346,18 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified
3339
3346
3340
3347
### tidb_index_serial_scan_concurrency
3341
3348
3349
+
> **Warning:**
3350
+
>
3351
+
> This variable is deprecated and no longer controls execution behavior. The concurrency of sequential index scans is now controlled by [`tidb_executor_concurrency`](#tidb_executor_concurrency-new-in-v50), and [`ANALYZE TABLE`](/sql-statements/sql-statement-analyze-table.md) uses [`tidb_analyze_distsql_scan_concurrency`](#tidb_analyze_distsql_scan_concurrency-new-in-v760) to control the concurrency of index statistics scans.
3352
+
3342
3353
- Scope: SESSION | GLOBAL
3343
3354
- Persists to cluster: Yes
3344
3355
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes
3345
3356
- Type: Integer
3346
3357
- Default value: `1`
3347
3358
- Range: `[1, 256]`
3348
3359
- Unit: Threads
3349
-
- This variable is used to set the concurrency of the `serial scan` operation.
3350
-
- Use a bigger value in OLAP scenarios, and a smaller value in OLTP scenarios.
3360
+
- This variable remains only for backward compatibility. Use [`tidb_executor_concurrency`](#tidb_executor_concurrency-new-in-v50) to control the concurrency of sequential index scans, or [`tidb_analyze_distsql_scan_concurrency`](#tidb_analyze_distsql_scan_concurrency-new-in-v760) to control the concurrency of index statistics scans.
3351
3361
3352
3362
### tidb_init_chunk_size
3353
3363
@@ -3824,7 +3834,7 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified
3824
3834
- Persists to cluster: Yes
3825
3835
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
3826
3836
- Default value: `1`
3827
-
- This variable specifies the concurrency of merging statistics for a partitioned table when TiDB analyzes the partitioned table.
3837
+
- This variable controls the concurrency for merging TopN results of partitioned tables.
3828
3838
3829
3839
### tidb_enable_async_merge_global_stats <span class="version-mark">New in v7.5.0</span>
Copy file name to clipboardExpand all lines: troubleshoot-tidb-oom.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,6 @@ You can take the following measures to reduce the memory usage of SQL statements
99
99
100
100
- Reduce the number of Regions to be read simultaneously or reduce the concurrency of operators to avoid memory problems caused by high concurrency. The corresponding system variables include:
- The concurrency of sessions is too high near the time point when the problem occurs. In this case, consider scaling out the TiDB cluster by adding more TiDB nodes.
@@ -195,4 +194,4 @@ To locate the root cause of an OOM issue, you need to collect the following info
0 commit comments