Skip to content

Commit d9124e8

Browse files
authored
tidb: update tidb_index_serial_scan_concurrency docs (#21938) (#23266)
1 parent 8cb048c commit d9124e8

3 files changed

Lines changed: 34 additions & 19 deletions

File tree

statistics.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -763,23 +763,29 @@ The relationships of the relevant system variables are shown below:
763763

764764
#### `tidb_build_stats_concurrency`
765765

766-
When you run the `ANALYZE` statement, the task is divided into multiple small tasks. Each task only works on statistics of one column or index. 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 number of table or partition analysis tasks that can be processed simultaneously. The default value is `2`. The default value is `4` for v7.4.0 and earlier versions.
767767

768768
#### `tidb_build_sampling_stats_concurrency`
769769

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`.
771776

772777
#### `tidb_analyze_partition_concurrency`
773778

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 and histograms to system tables). The default value is `2`. The default value is `1` for v7.4.0 and earlier versions.
775780

776-
#### `tidb_distsql_scan_concurrency`
781+
#### `tidb_analyze_distsql_scan_concurrency`
777782

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:
779784

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).
781787

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.
788+
The default value is `4`.
783789

784790
## See also
785791

system-variables.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,21 +1114,28 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a
11141114
11151115
### tidb_analyze_distsql_scan_concurrency <span class="version-mark">New in v7.6.0</span>
11161116
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+
11171121
- Scope: SESSION | GLOBAL
11181122
- Persists to cluster: Yes
11191123
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
11201124
- Type: Integer
11211125
- Default value: `4`
11221126
- 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.
11241130
11251131
### tidb_analyze_partition_concurrency
11261132
11271133
- Scope: SESSION | GLOBAL
11281134
- Persists to cluster: Yes
11291135
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
11301136
- 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.
11321139
11331140
### tidb_analyze_version <span class="version-mark">New in v5.1.0</span>
11341141
@@ -1250,7 +1257,7 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
12501257
- Type: Integer
12511258
- Default value: `1`
12521259
- 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.
12541261

12551262
### tidb_backoff_lock_fast
12561263

@@ -1355,8 +1362,7 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
13551362
- Default value: `2`. The default value is `4` for v7.4.0 and earlier versions.
13561363
- Range: `[1, 256]`
13571364
- 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.
13601366

13611367
### tidb_build_sampling_stats_concurrency <span class="version-mark">New in v7.5.0</span>
13621368

@@ -1367,8 +1373,9 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
13671373
- Unit: Threads
13681374
- Default value: `2`
13691375
- 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.
13721379

13731380
### tidb_capture_plan_baselines <span class="version-mark">New in v4.0</span>
13741381

@@ -3339,15 +3346,18 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified
33393346
33403347
### tidb_index_serial_scan_concurrency
33413348
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+
33423353
- Scope: SESSION | GLOBAL
33433354
- Persists to cluster: Yes
33443355
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes
33453356
- Type: Integer
33463357
- Default value: `1`
33473358
- Range: `[1, 256]`
33483359
- 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.
33513361
33523362
### tidb_init_chunk_size
33533363
@@ -3824,7 +3834,7 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified
38243834
- Persists to cluster: Yes
38253835
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
38263836
- 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.
38283838
38293839
### tidb_enable_async_merge_global_stats <span class="version-mark">New in v7.5.0</span>
38303840

troubleshoot-tidb-oom.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ You can take the following measures to reduce the memory usage of SQL statements
9999
100100
- 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:
101101
- [`tidb_distsql_scan_concurrency`](/system-variables.md#tidb_distsql_scan_concurrency)
102-
- [`tidb_index_serial_scan_concurrency`](/system-variables.md#tidb_index_serial_scan_concurrency)
103102
- [`tidb_executor_concurrency`](/system-variables.md#tidb_executor_concurrency-new-in-v50)
104103
105104
- 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
195194
## See also
196195
197196
- [TiDB Memory Control](/configure-memory-usage.md)
198-
- [Tune TiKV Memory Parameter Performance](/tune-tikv-memory-performance.md)
197+
- [Tune TiKV Memory Parameter Performance](/tune-tikv-memory-performance.md)

0 commit comments

Comments
 (0)