From ebb63285022608121daedeaa4778801d7f0149c1 Mon Sep 17 00:00:00 2001 From: 0xPoe Date: Sun, 19 Oct 2025 19:41:48 +0200 Subject: [PATCH 1/2] tidb: correct some variables descriptions --- best-practices/tidb-best-practices.md | 2 +- sql-statements/sql-statement-show-variables.md | 4 ++-- statistics.md | 2 +- system-variables.md | 17 +++++++++-------- .../v6.5-performance-benchmarking-with-tpcc.md | 2 +- .../v7.1-performance-benchmarking-with-tpcc.md | 2 +- .../v7.5-performance-benchmarking-with-tpcc.md | 2 +- .../v8.1-performance-benchmarking-with-tpcc.md | 2 +- .../v8.5-performance-benchmarking-with-tpcc.md | 2 +- tidb-lightning/tidb-lightning-configuration.md | 6 +++--- troubleshoot-tidb-oom.md | 4 ++-- 11 files changed, 23 insertions(+), 22 deletions(-) diff --git a/best-practices/tidb-best-practices.md b/best-practices/tidb-best-practices.md index c7cca03df2d46..5f1a025dd6b31 100644 --- a/best-practices/tidb-best-practices.md +++ b/best-practices/tidb-best-practices.md @@ -130,7 +130,7 @@ Lots of MySQL experience is also applicable to TiDB. It is noted that TiDB has i * Ensure the order of results through indexes - You can use indexes to filter or sort data. Firstly, get row IDs according to the index order. Then, return the row content according to the return order of row IDs. In this way, the returned results are ordered according to the index column. It has been mentioned earlier that the model of scanning index and getting row is parallel + pipeline. If the row is returned according to the index order, a high concurrency between two queries does not reduce latency. Thus, the concurrency is low by default, but it can be modified through the [`tidb_index_serial_scan_concurrency`](/system-variables.md#tidb_index_serial_scan_concurrency) variable. + You can use indexes to filter or sort data. Firstly, get row IDs according to the index order. Then, return the row content according to the return order of row IDs. In this way, the returned results are ordered according to the index column. It has been mentioned earlier that the model of scanning index and getting row is parallel + pipeline. If the row is returned according to the index order, a high concurrency between two queries does not reduce latency. Thus, the concurrency is low by default, but you can increase it by adjusting [`tidb_executor_concurrency`](/system-variables.md#tidb_executor_concurrency-new-in-v50). * Reverse index scan diff --git a/sql-statements/sql-statement-show-variables.md b/sql-statements/sql-statement-show-variables.md index fbf38a26abaaf..56aaace069052 100644 --- a/sql-statements/sql-statement-show-variables.md +++ b/sql-statements/sql-statement-show-variables.md @@ -76,7 +76,7 @@ mysql> SHOW GLOBAL VARIABLES LIKE 'tidb%'; | tidb_index_lookup_concurrency | 4 | | tidb_index_lookup_join_concurrency | 4 | | tidb_index_lookup_size | 20000 | -| tidb_index_serial_scan_concurrency | 1 | +| tidb_index_serial_scan_concurrency | 5 | | tidb_init_chunk_size | 32 | | tidb_isolation_read_engines | tikv, tiflash, tidb | | tidb_low_resolution_tso | 0 | @@ -173,4 +173,4 @@ The `SHOW [GLOBAL|SESSION] VARIABLES` statement in TiDB is fully compatible with ## See also -* [`SET [GLOBAL|SESSION]`](/sql-statements/sql-statement-set-variable.md) \ No newline at end of file +* [`SET [GLOBAL|SESSION]`](/sql-statements/sql-statement-set-variable.md) diff --git a/statistics.md b/statistics.md index 11c4baee08105..058333cb715f1 100644 --- a/statistics.md +++ b/statistics.md @@ -768,7 +768,7 @@ When you analyze regular columns, you can use the [`tidb_distsql_scan_concurrenc #### `tidb_index_serial_scan_concurrency` -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. +[`tidb_index_serial_scan_concurrency`](/system-variables.md#tidb_index_serial_scan_concurrency) is deprecated and read-only. Index statistics collection now follows [`tidb_analyze_distsql_scan_concurrency`](/system-variables.md#tidb_analyze_distsql_scan_concurrency), so adjust that variable to change the number of Regions read for index statistics. ## See also diff --git a/system-variables.md b/system-variables.md index 28a74eff6cb86..1e58dd8c35250 100644 --- a/system-variables.md +++ b/system-variables.md @@ -3506,15 +3506,16 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified ### tidb_index_serial_scan_concurrency -- Scope: SESSION | GLOBAL +> **Warning:** +> +> This variable is deprecated and cannot be modified. Sequential index scans now follow [`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) to control index read concurrency. + +- Scope: SESSION | GLOBAL (read-only) - Persists to cluster: Yes -- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes -- Type: Integer -- Default value: `1` -- Range: `[1, 256]` -- Unit: Threads -- This variable is used to set the concurrency of the `serial scan` operation. -- Use a bigger value in OLAP scenarios, and a smaller value in OLTP scenarios. +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No +- Type: Read-only integer alias +- Default value: matches the current value of [`tidb_executor_concurrency`](#tidb_executor_concurrency-new-in-v50) +- This variable remains only for backward compatibility. Adjust [`tidb_executor_concurrency`](#tidb_executor_concurrency-new-in-v50) to affect sequential index scans, or [`tidb_analyze_distsql_scan_concurrency`](#tidb_analyze_distsql_scan_concurrency) to tune index statistics collection. ### tidb_init_chunk_size diff --git a/tidb-cloud/v6.5-performance-benchmarking-with-tpcc.md b/tidb-cloud/v6.5-performance-benchmarking-with-tpcc.md index 3538c4001f194..0045c5c527097 100644 --- a/tidb-cloud/v6.5-performance-benchmarking-with-tpcc.md +++ b/tidb-cloud/v6.5-performance-benchmarking-with-tpcc.md @@ -85,7 +85,7 @@ This section introduces how to perform the TPC-C performance test step by step. ```sql SET tidb_build_stats_concurrency=16; SET tidb_distsql_scan_concurrency=16; - SET tidb_index_serial_scan_concurrency=16; + SET tidb_analyze_distsql_scan_concurrency=16; ``` 5. Run the following `go-tpc tpcc` command to conduct stress tests on the TiDB Cloud Dedicated cluster. For each concurrency, the test takes two hours. diff --git a/tidb-cloud/v7.1-performance-benchmarking-with-tpcc.md b/tidb-cloud/v7.1-performance-benchmarking-with-tpcc.md index 4cd0f9f38710e..236b64286eccb 100644 --- a/tidb-cloud/v7.1-performance-benchmarking-with-tpcc.md +++ b/tidb-cloud/v7.1-performance-benchmarking-with-tpcc.md @@ -86,7 +86,7 @@ This section introduces how to perform the TPC-C performance test step by step. ```sql SET tidb_build_stats_concurrency=16; SET tidb_distsql_scan_concurrency=16; - SET tidb_index_serial_scan_concurrency=16; + SET tidb_analyze_distsql_scan_concurrency=16; ``` 5. Run the following `go-tpc tpcc` command to conduct stress tests on the TiDB Cloud Dedicated cluster. For each concurrency, the test takes two hours. diff --git a/tidb-cloud/v7.5-performance-benchmarking-with-tpcc.md b/tidb-cloud/v7.5-performance-benchmarking-with-tpcc.md index 63ec70b77b0f1..1eae2afdbbe5a 100644 --- a/tidb-cloud/v7.5-performance-benchmarking-with-tpcc.md +++ b/tidb-cloud/v7.5-performance-benchmarking-with-tpcc.md @@ -86,7 +86,7 @@ This section introduces how to perform the TPC-C performance test step by step. ```sql SET tidb_build_stats_concurrency=16; SET tidb_distsql_scan_concurrency=16; - SET tidb_index_serial_scan_concurrency=16; + SET tidb_analyze_distsql_scan_concurrency=16; ``` 5. Run the following `go-tpc tpcc` command to conduct stress tests on the TiDB Cloud Dedicated cluster. For each concurrency, the test takes two hours. diff --git a/tidb-cloud/v8.1-performance-benchmarking-with-tpcc.md b/tidb-cloud/v8.1-performance-benchmarking-with-tpcc.md index 8aad399883823..6353979d591c9 100644 --- a/tidb-cloud/v8.1-performance-benchmarking-with-tpcc.md +++ b/tidb-cloud/v8.1-performance-benchmarking-with-tpcc.md @@ -97,7 +97,7 @@ This section introduces how to perform the TPC-C performance test step by step. ```sql SET tidb_build_stats_concurrency=16; SET tidb_distsql_scan_concurrency=16; - SET tidb_index_serial_scan_concurrency=16; + SET tidb_analyze_distsql_scan_concurrency=16; ``` 5. Run the following `go-tpc tpcc` command to conduct stress tests on the TiDB Cloud Dedicated cluster. For each concurrency, the test takes two hours. diff --git a/tidb-cloud/v8.5-performance-benchmarking-with-tpcc.md b/tidb-cloud/v8.5-performance-benchmarking-with-tpcc.md index 53abd9096c0cb..09c07e0b9d28d 100644 --- a/tidb-cloud/v8.5-performance-benchmarking-with-tpcc.md +++ b/tidb-cloud/v8.5-performance-benchmarking-with-tpcc.md @@ -97,7 +97,7 @@ This section introduces how to perform the TPC-C performance test step by step. ```sql SET tidb_build_stats_concurrency=16; SET tidb_distsql_scan_concurrency=16; - SET tidb_index_serial_scan_concurrency=16; + SET tidb_analyze_distsql_scan_concurrency=16; ``` 5. Run the following `go-tpc tpcc` command to conduct stress tests on the TiDB Cloud Dedicated cluster. For each concurrency, the test takes two hours. diff --git a/tidb-lightning/tidb-lightning-configuration.md b/tidb-lightning/tidb-lightning-configuration.md index d9fba98de07e5..6a76aefeb823c 100644 --- a/tidb-lightning/tidb-lightning-configuration.md +++ b/tidb-lightning/tidb-lightning-configuration.md @@ -564,9 +564,9 @@ Configures how CSV files are parsed. #### `index-serial-scan-concurrency` -- Sets the TiDB session variable to speed up the Checksum and Analyze operations. For more information, see [Control `ANALYZE` concurrency](/statistics.md#control-analyze-concurrency). - - +> **Warning:** +> +> Deprecated. TiDB Lightning keeps this option for compatibility, but TiDB now ignores the underlying `tidb_index_serial_scan_concurrency` system variable. Sequential index scans follow [`tidb_executor_concurrency`](/system-variables.md#tidb_executor_concurrency-new-in-v50), and index statistics collection follows [`tidb_analyze_distsql_scan_concurrency`](/system-variables.md#tidb_analyze_distsql_scan_concurrency). #### `checksum-table-concurrency` diff --git a/troubleshoot-tidb-oom.md b/troubleshoot-tidb-oom.md index 1c2f102cd0681..95f15840dbd72 100644 --- a/troubleshoot-tidb-oom.md +++ b/troubleshoot-tidb-oom.md @@ -99,7 +99,7 @@ You can take the following measures to reduce the memory usage of SQL statements - 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: - [`tidb_distsql_scan_concurrency`](/system-variables.md#tidb_distsql_scan_concurrency) - - [`tidb_index_serial_scan_concurrency`](/system-variables.md#tidb_index_serial_scan_concurrency) + - [`tidb_analyze_distsql_scan_concurrency`](/system-variables.md#tidb_analyze_distsql_scan_concurrency) - [`tidb_executor_concurrency`](/system-variables.md#tidb_executor_concurrency-new-in-v50) - 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 +195,4 @@ To locate the root cause of an OOM issue, you need to collect the following info ## See also - [TiDB Memory Control](/configure-memory-usage.md) -- [Tune TiKV Memory Parameter Performance](/tune-tikv-memory-performance.md) \ No newline at end of file +- [Tune TiKV Memory Parameter Performance](/tune-tikv-memory-performance.md) From 6657f03dd2dff5c976fc8cfebc7865b90eeeb7e0 Mon Sep 17 00:00:00 2001 From: 0xPoe Date: Sun, 19 Oct 2025 19:43:36 +0200 Subject: [PATCH 2/2] fix: update --- sql-statements/sql-statement-show-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-show-variables.md b/sql-statements/sql-statement-show-variables.md index 56aaace069052..298cc9c1bc0f2 100644 --- a/sql-statements/sql-statement-show-variables.md +++ b/sql-statements/sql-statement-show-variables.md @@ -76,7 +76,7 @@ mysql> SHOW GLOBAL VARIABLES LIKE 'tidb%'; | tidb_index_lookup_concurrency | 4 | | tidb_index_lookup_join_concurrency | 4 | | tidb_index_lookup_size | 20000 | -| tidb_index_serial_scan_concurrency | 5 | +| tidb_index_serial_scan_concurrency | 1 | | tidb_init_chunk_size | 32 | | tidb_isolation_read_engines | tikv, tiflash, tidb | | tidb_low_resolution_tso | 0 |