Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,15 +407,20 @@ The relationships of the relevant system variables are shown below:

#### `tidb_build_stats_concurrency`

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

#### `tidb_build_sampling_stats_concurrency`

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`.
This variable controls the following aspects of `ANALYZE` concurrency:

- The concurrency for merging samples collected from different Regions.
- 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.

The default value is `2`.

#### `tidb_analyze_partition_concurrency`

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

#### `tidb_distsql_scan_concurrency`

Expand Down
14 changes: 7 additions & 7 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Default value: `2`. The default value is `1` for v7.4.0 and earlier versions.
- This variable specifies the concurrency of reading and writing statistics for a partitioned table when TiDB analyzes the partitioned table.
- For manual and auto `ANALYZE`, this variable controls the concurrency for saving `ANALYZE` results, including writing TopN and histograms to system tables.

### tidb_analyze_version <span class="version-mark">New in v5.1.0</span>

Expand Down Expand Up @@ -1214,7 +1214,7 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
- Type: Integer
- Default value: `1`
- Range: `[1, 256]`
- This variable is used to set the concurrency of executing the automatic update of statistics.
- 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.

### tidb_backoff_lock_fast

Expand Down Expand Up @@ -1319,8 +1319,7 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
- Default value: `2`. The default value is `4` for v7.4.0 and earlier versions.
- Range: `[1, 256]`
- Unit: Threads
- This variable is used to set the concurrency of executing the `ANALYZE` statement.
- When the variable is set to a larger value, the execution performance of other queries is affected.
- 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.

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

Expand All @@ -1331,8 +1330,9 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
- Unit: Threads
- Default value:`2`
- Range: `[1, 256]`
- This variable is used to set the sampling concurrency in the `ANALYZE` process.
- When the variable is set to a larger value, the execution performance of other queries is affected.
- This variable controls the following aspects of `ANALYZE` concurrency:
- The concurrency for merging samples collected from different Regions.
- 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.

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

Expand Down Expand Up @@ -3663,7 +3663,7 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Default value: `1`
- This variable specifies the concurrency of merging statistics for a partitioned table when TiDB analyzes the partitioned table.
- This variable controls the concurrency for merging TopN results of partitioned tables.

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

Expand Down
Loading