Skip to content

tidb: update tidb_index_serial_scan_concurrency docs (#21938)#23264

Open
ti-chi-bot wants to merge 7 commits into
pingcap:release-7.1from
ti-chi-bot:cherry-pick-21938-to-release-7.1
Open

tidb: update tidb_index_serial_scan_concurrency docs (#21938)#23264
ti-chi-bot wants to merge 7 commits into
pingcap:release-7.1from
ti-chi-bot:cherry-pick-21938-to-release-7.1

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #21938

First-time contributors' checklist

What is changed, added or deleted? (Required)

See: pingcap/tidb#64023

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)

What is the related PR or file link(s)?

  • This PR is translated from:
  • Other reference link(s):

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm needs-1-more-lgtm Indicates a PR needs 1 more LGTM. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR. labels Jul 14, 2026
@ti-chi-bot

Copy link
Copy Markdown
Member Author

@0xPoe This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot

ti-chi-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 14, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates TiDB documentation, including best practices, statistics, and system variables, and introduces new TPC-C performance test reports for TiDB Cloud v8.1.0 and v8.5.0. The primary feedback is critical: multiple files contain unresolved git merge conflict markers that must be resolved before merging. Additionally, several minor style guide violations—such as document personification, unnecessary wordiness, and incorrect verb tenses—were identified and should be corrected in the newly added performance test reports and best practices documentation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread system-variables.md Outdated
Comment on lines +1247 to +1262
<<<<<<< HEAD
=======
### tidb_build_sampling_stats_concurrency <span class="version-mark">New in v7.5.0</span>

- Scope: SESSION | GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Integer
- Unit: Threads
- Default value: `2`
- Range: `[1, 256]`
- 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.

>>>>>>> 3d8180e56a (tidb: update tidb_index_serial_scan_concurrency docs (#21938))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Unresolved git merge conflict markers found in this section. Please resolve the conflict by keeping the newly added system variable tidb_build_sampling_stats_concurrency.

Suggested change
<<<<<<< HEAD
=======
### tidb_build_sampling_stats_concurrency <span class="version-mark">New in v7.5.0</span>
- Scope: SESSION | GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Integer
- Unit: Threads
- Default value: `2`
- Range: `[1, 256]`
- 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.
>>>>>>> 3d8180e56a (tidb: update tidb_index_serial_scan_concurrency docs (#21938))
### tidb_build_sampling_stats_concurrency <span class="version-mark">New in v7.5.0</span>
- Scope: SESSION | GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Integer
- Unit: Threads
- Default value: `2`
- Range: `[1, 256]`
- 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.

Comment thread statistics.md Outdated
Comment on lines +433 to +450
<<<<<<< HEAD
Currently, when you run the `ANALYZE` statement, the task is divided into multiple small tasks. Each task only works on one column or index. You can use the `tidb_build_stats_concurrency` parameter to control the number of simultaneous tasks. The default value is `4`.
=======
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_distsql_scan_concurrency`
#### `tidb_build_sampling_stats_concurrency`

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`

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.
>>>>>>> 3d8180e56a (tidb: update tidb_index_serial_scan_concurrency docs (#21938))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Unresolved git merge conflict markers found in this section. Please resolve the conflict by keeping the updated documentation for ANALYZE concurrency variables and removing the conflict markers.

Suggested change
<<<<<<< HEAD
Currently, when you run the `ANALYZE` statement, the task is divided into multiple small tasks. Each task only works on one column or index. You can use the `tidb_build_stats_concurrency` parameter to control the number of simultaneous tasks. The default value is `4`.
=======
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_distsql_scan_concurrency`
#### `tidb_build_sampling_stats_concurrency`
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`
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.
>>>>>>> 3d8180e56a (tidb: update tidb_index_serial_scan_concurrency docs (#21938))
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`
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`
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.

Comment thread statistics.md Outdated
Comment on lines 454 to 465
<<<<<<< HEAD
When you analyze regular columns, you can use the `tidb_distsql_scan_concurrency` parameter to control the number of Region to be read at one time. The default value is `15`.
=======
This variable controls the following aspects of `ANALYZE` concurrency:
>>>>>>> 3d8180e56a (tidb: update tidb_index_serial_scan_concurrency docs (#21938))

#### `tidb_index_serial_scan_concurrency`
- The concurrency of scanning TiKV Regions.
- The concurrency of scanning Regions for special indexes (indexes generated from virtual columns).

<<<<<<< HEAD
When you analyze index columns, you can use the `tidb_index_serial_scan_concurrency` parameter to control the number of Region to be read at one time. The default value is `1`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Unresolved git merge conflict markers found in this section. Please resolve the conflict by keeping the updated tidb_analyze_distsql_scan_concurrency variable description and removing the deprecated tidb_index_serial_scan_concurrency section.

Suggested change
<<<<<<< HEAD
When you analyze regular columns, you can use the `tidb_distsql_scan_concurrency` parameter to control the number of Region to be read at one time. The default value is `15`.
=======
This variable controls the following aspects of `ANALYZE` concurrency:
>>>>>>> 3d8180e56a (tidb: update tidb_index_serial_scan_concurrency docs (#21938))
#### `tidb_index_serial_scan_concurrency`
- The concurrency of scanning TiKV Regions.
- The concurrency of scanning Regions for special indexes (indexes generated from virtual columns).
<<<<<<< HEAD
When you analyze index columns, you can use the `tidb_index_serial_scan_concurrency` parameter to control the number of Region to be read at one time. The default value is `1`.
This variable controls the following aspects of `ANALYZE` concurrency:
- The concurrency of scanning TiKV Regions.
- The concurrency of scanning Regions for special indexes (indexes generated from virtual columns).

Comment thread statistics.md Outdated
Comment on lines +923 to +925
=======
The default value is `4`.
>>>>>>> 3d8180e56a (tidb: update tidb_index_serial_scan_concurrency docs (#21938))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Unresolved git merge conflict markers found at the end of the file. Please remove these conflict markers and the misplaced default value description.

Comment thread system-variables.md Outdated
Comment on lines +961 to +996
<<<<<<< HEAD
=======
### tidb_analyze_column_options <span class="version-mark">New in v8.3.0</span>

> **Note:**
>
> - This variable only works when [`tidb_analyze_version`](#tidb_analyze_version-new-in-v510) is set to `2`.
> - If you upgrade your TiDB cluster from a version earlier than v8.3.0 to v8.3.0 or later, this variable is set to `ALL` by default to keep the original behavior.
> - For a newly deployed TiDB cluster from v8.3.0 to v8.5.4, this variable is set to `PREDICATE` by default.
> - For a newly deployed TiDB cluster from v8.5.5 and v9.0.0 onwards, this variable is set to `ALL` by default.

- Scope: GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Enumeration
- Default value: `ALL`
- Value options:`ALL`, `PREDICATE`
- This variable controls the behavior of the `ANALYZE TABLE` statement. Setting it to `PREDICATE` means only collecting statistics for [predicate columns](/statistics.md#collect-statistics-on-some-columns); setting it to `ALL` means collecting statistics for all columns. In scenarios where OLAP queries are used, it is recommended to set it to `ALL`, otherwise collecting statistics can result in a significant drop in query performance.

### tidb_analyze_distsql_scan_concurrency <span class="version-mark">New in v7.6.0</span>

> **Note:**
>
> 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`.

- Scope: SESSION | GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Integer
- Default value: `4`
- Range: `[0, 4294967295]`. In versions earlier than v8.2.0, the minimum value is `1`. When you set it to `0`, it adaptively adjusts the concurrency based on the cluster size.
- This variable controls the following aspects of `ANALYZE` concurrency:
- The concurrency of scanning TiKV Regions.
- The concurrency of scanning Regions for special indexes, such as indexes on generated virtual columns.

>>>>>>> 3d8180e56a (tidb: update tidb_index_serial_scan_concurrency docs (#21938))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Unresolved git merge conflict markers found in this section. Please resolve the conflict by keeping the newly added system variables tidb_analyze_column_options and tidb_analyze_distsql_scan_concurrency.

### tidb_analyze_column_options <span class="version-mark">New in v8.3.0</span>

> **Note:**
>
> - This variable only works when [`tidb_analyze_version`](#tidb_analyze_version-new-in-v510) is set to `2`.
> - If you upgrade your TiDB cluster from a version earlier than v8.3.0 to v8.3.0 or later, this variable is set to `ALL` by default to keep the original behavior.
> - For a newly deployed TiDB cluster from v8.3.0 to v8.5.4, this variable is set to `PREDICATE` by default.
> - For a newly deployed TiDB cluster from v8.5.5 and v9.0.0 onwards, this variable is set to `ALL` by default.

- Scope: GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Enumeration
- Default value: `ALL`
- Value options:`ALL`, `PREDICATE`
- This variable controls the behavior of the `ANALYZE TABLE` statement. Setting it to `PREDICATE` means only collecting statistics for [predicate columns](/statistics.md#collect-statistics-on-some-columns); setting it to `ALL` means collecting statistics for all columns. In scenarios where OLAP queries are used, it is recommended to set it to `ALL`, otherwise collecting statistics can result in a significant drop in query performance.

### tidb_analyze_distsql_scan_concurrency <span class="version-mark">New in v7.6.0</span>

> **Note:**
>
> 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`.

- Scope: SESSION | GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Integer
- Default value: `4`
- Range: `[0, 4294967295]`. In versions earlier than v8.2.0, the minimum value is `1`. When you set it to `0`, it adaptively adjusts the concurrency based on the cluster size.
- This variable controls the following aspects of `ANALYZE` concurrency:
    - The concurrency of scanning TiKV Regions.
    - The concurrency of scanning Regions for special indexes, such as indexes on generated virtual columns.

>
> For TiDB Cloud, to modify the TiKV parameters of your cluster, you can contact [PingCAP Support](/tidb-cloud/tidb-cloud-support.md) for help.

The TiKV parameter [`prefill-for-recycle`](https://docs.pingcap.com/tidb/stable/tikv-configuration-file#prefill-for-recycle-new-in-v700) can make log recycling effective immediately after initialization. This document conducts tests with `prefill-for-recycle` enabled:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Avoid personification of documents ("This document conducts tests"). Rephrase to use active voice or passive voice appropriately (e.g., "The tests in this document are conducted...").

Suggested change
The TiKV parameter [`prefill-for-recycle`](https://docs.pingcap.com/tidb/stable/tikv-configuration-file#prefill-for-recycle-new-in-v700) can make log recycling effective immediately after initialization. This document conducts tests with `prefill-for-recycle` enabled:
The TiKV parameter [`prefill-for-recycle`](https://docs.pingcap.com/tidb/stable/tikv-configuration-file#prefill-for-recycle-new-in-v700) can make log recycling effective immediately after initialization. The tests in this document are conducted with `prefill-for-recycle` enabled:


## Test steps

This section introduces how to perform the TPC-C performance test step by step.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Use "describes" instead of "introduces" for a more professional and precise technical writing tone.

Suggested change
This section introduces how to perform the TPC-C performance test step by step.
This section describes how to perform the TPC-C performance test step by step.

curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/pingcap/go-tpc/master/install.sh | sh
```

2. Run the following `go-tpc tpcc` command to import 1,000 warehouses to the `tpcc` database. Replace `${HOST}`, `${THREAD}`, and `${PASSWORD}` with your actual values. This document conducts three tests with the `${THREAD}` value of `50`, `100`, and `200`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Avoid personification of documents ("This document conducts three tests"). Rephrase to state that the tests are conducted with three different thread counts.

Suggested change
2. Run the following `go-tpc tpcc` command to import 1,000 warehouses to the `tpcc` database. Replace `${HOST}`, `${THREAD}`, and `${PASSWORD}` with your actual values. This document conducts three tests with the `${THREAD}` value of `50`, `100`, and `200`.
2. Run the following `go-tpc tpcc` command to import 1,000 warehouses to the `tpcc` database. Replace `${HOST}`, `${THREAD}`, and `${PASSWORD}` with your actual values. The tests are conducted with three different thread counts: `50`, `100`, and `200`.

ANALYZE TABLE warehouse;
```

To accelerate the collection of statistics, execute the following SQL statements before collecting:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Simplify the sentence and use active voice. "before collecting" can be simplified to "before running ANALYZE:".

Suggested change
To accelerate the collection of statistics, execute the following SQL statements before collecting:
To accelerate statistics collection, run the following SQL statements before running `ANALYZE`:
References
  1. Avoid unnecessary words and repetition. (link)


6. Extract the tpmC data of `NEW_ORDER` from the result.

TPC-C uses tpmC (transactions per minute) to measure the maximum qualified throughput (MQTh, Max Qualified Throughput). The transactions are the NewOrder transactions and the final unit of measure is the number of new orders processed per minute.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Improve the flow and grammar of the sentence. "The transactions are the NewOrder transactions" can be rephrased to "These transactions are NewOrder transactions".

Suggested change
TPC-C uses tpmC (transactions per minute) to measure the maximum qualified throughput (MQTh, Max Qualified Throughput). The transactions are the NewOrder transactions and the final unit of measure is the number of new orders processed per minute.
TPC-C uses tpmC (transactions per minute) to measure the maximum qualified throughput (MQTh, Max Qualified Throughput). These transactions are NewOrder transactions, and the final unit of measure is the number of new orders processed per minute.

@ti-chi-bot ti-chi-bot Bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 15, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign breezewish for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 15, 2026
@qiancai qiancai removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm needs-1-more-lgtm Indicates a PR needs 1 more LGTM. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants