From 691df735b1457d7357bc6d93a18e591763a0bfaf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 13 Apr 2026 04:02:41 +0000 Subject: [PATCH] Auto-sync: Update English docs from Chinese PR Synced from: https://github.com/pingcap/docs-cn/pull/21434 Target PR: https://github.com/pingcap/docs/pull/22739 AI Provider: azure Co-authored-by: github-actions[bot] --- system-variable-reference.md | 6 ++++++ system-variables.md | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/system-variable-reference.md b/system-variable-reference.md index 76a846ad2b039..508b088db52bb 100644 --- a/system-variable-reference.md +++ b/system-variable-reference.md @@ -3069,6 +3069,12 @@ Referenced in: - [System Variables](/system-variables.md#tidb_opt_hash_join_cost_factor-new-in-v853-and-v900) - [TiDB 8.5.3 Release Notes](/releases/release-8.5.3.md) +### tidb_opt_index_join_build_v2 + +Documents that refer to this variable: + +- [System Variables](/system-variables.md#tidb_opt_index_join_build_v2-introduced-in-v900) + ### tidb_opt_index_join_cost_factor Referenced in: diff --git a/system-variables.md b/system-variables.md index 3aba9c49f90da..c211b7f68818f 100644 --- a/system-variables.md +++ b/system-variables.md @@ -4798,10 +4798,10 @@ mysql> desc select count(distinct a) from test.t; - Type: Enum - Default value: `DISABLE` - Possible values: `DISABLE`, `COST` -- Controls whether the optimizer can leverage the partial order of an index to optimize TopN computation when a query contains `ORDER BY ... LIMIT`. When the sort column matches the index order (for example, the sort column is an index column or has a prefix index), the data returned by the index scan is already partially ordered on that column. In this case, the optimizer can incrementally build the TopN result during the scan and stop early once the `LIMIT` is satisfied, thereby reducing sorting overhead. +- Controls whether the optimizer can leverage the partial order of an index to optimize TopN computation when a query contains `ORDER BY ... LIMIT`. When the sort column matches the index order (for example, the sort column is an index column or has a prefix index), the data returned by the index scan is already partially ordered on that column. In this case, the optimizer can incrementally build the TopN result during the scan and stop early once the `LIMIT` is satisfied, thereby reducing sorting overhead. - Usage scenarios: When the sort column in an `ORDER BY ... LIMIT` clause is a long string with only a prefix index, to reduce the TopN sorting overhead, you can set this variable to `COST` and specify a `USE INDEX` or `FORCE INDEX` hint in the query to enable the partial order TopN optimization. - - The default value is `DISABLE`, which means the partial order TopN optimization is disabled. In this case, the optimizer uses the standard global sorting approach for TopN. + - The default value is `DISABLE`, which means the partial order TopN optimization is disabled. In this case, the optimizer uses the standard global sorting approach for TopN. - To force the use of the partial order TopN optimization, set this variable to `COST` and specify a qualifying index in the query using `USE INDEX` or `FORCE INDEX`. If the specified index does not meet the prerequisites for this optimization (for example, the `ORDER BY` clause does not match the index prefix, or the query contains unsupported ordering patterns), the optimization might not be applied even when the variable is set to `COST`, and the execution plan falls back to the standard TopN approach. > **Note:** @@ -5201,6 +5201,17 @@ SHOW WARNINGS; - Range: `[0, 2147483647]` - Default value: `1` +### `tidb_opt_index_join_build_v2` New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Persists to cluster: Yes +- Controlled by the Hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No +- Type: Boolean +- Default value: `ON` +- This variable is retained for compatibility only. TiDB always uses the Index Join build v2 path, and you cannot switch back to v1 through this variable. +- If you set this variable to `OFF`, TiDB returns an error indicating that this capability is always enabled. +- After upgrading from an earlier version, even if the historical value of this variable is retained in `mysql.global_variables`, TiDB still treats it as `ON`. + ### tidb_opt_index_join_cost_factor New in v8.5.3 and v9.0.0 > **Warning:**