Skip to content

Commit 691df73

Browse files
Auto-sync: Update English docs from Chinese PR
Synced from: pingcap/docs-cn#21434 Target PR: #22739 AI Provider: azure Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 0813b50 commit 691df73

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

system-variable-reference.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3069,6 +3069,12 @@ Referenced in:
30693069
- [System Variables](/system-variables.md#tidb_opt_hash_join_cost_factor-new-in-v853-and-v900)
30703070
- [TiDB 8.5.3 Release Notes](/releases/release-8.5.3.md)
30713071

3072+
### tidb_opt_index_join_build_v2
3073+
3074+
Documents that refer to this variable:
3075+
3076+
- [System Variables](/system-variables.md#tidb_opt_index_join_build_v2-introduced-in-v900)
3077+
30723078
### tidb_opt_index_join_cost_factor
30733079

30743080
Referenced in:

system-variables.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4798,10 +4798,10 @@ mysql> desc select count(distinct a) from test.t;
47984798
- Type: Enum
47994799
- Default value: `DISABLE`
48004800
- Possible values: `DISABLE`, `COST`
4801-
- 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.
4801+
- 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.
48024802
- 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.
48034803

4804-
- 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.
4804+
- 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.
48054805
- 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.
48064806

48074807
> **Note:**
@@ -5201,6 +5201,17 @@ SHOW WARNINGS;
52015201
- Range: `[0, 2147483647]`
52025202
- Default value: `1`
52035203
5204+
### `tidb_opt_index_join_build_v2` <span class="version-mark">New in v9.0.0</span>
5205+
5206+
- Scope: SESSION | GLOBAL
5207+
- Persists to cluster: Yes
5208+
- Controlled by the Hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
5209+
- Type: Boolean
5210+
- Default value: `ON`
5211+
- 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.
5212+
- If you set this variable to `OFF`, TiDB returns an error indicating that this capability is always enabled.
5213+
- 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`.
5214+
52045215
### tidb_opt_index_join_cost_factor <span class="version-mark">New in v8.5.3 and v9.0.0</span>
52055216
52065217
> **Warning:**

0 commit comments

Comments
 (0)