Skip to content

Commit bd5be4e

Browse files
authored
tidb: add the join order related variable tidb_opt_join_reorder_through_sel (#22477) (#22725)
1 parent 43358ab commit bd5be4e

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

system-variables.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4514,6 +4514,17 @@ mysql> desc select count(distinct a) from test.t;
45144514
- This variable is used to control the selection of the TiDB Join Reorder algorithm. When the number of nodes participating in Join Reorder is greater than this threshold, TiDB selects the greedy algorithm, and when it is less than this threshold, TiDB selects the dynamic programming algorithm.
45154515
- Currently, for OLTP queries, it is recommended to keep the default value. For OLAP queries, it is recommended to set the variable value to 10~15 to get better connection orders in OLAP scenarios.
45164516

4517+
### tidb_opt_join_reorder_through_sel <span class="version-mark">New in v8.5.6</span>
4518+
4519+
- Scope: SESSION | GLOBAL
4520+
- Persists to cluster: Yes
4521+
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes
4522+
- Type: Boolean
4523+
- Default value: `OFF`
4524+
- This variable improves Join Reorder optimization for certain multi-table join queries. If you set it to `ON`, the optimizer includes filter conditions (`Selection`) between multiple consecutive joins into the candidate range for Join Reorder optimization, provided safety conditions are met. When rebuilding the join tree, the optimizer pushes these conditions down to more suitable positions, which lets more tables participate in Join Reorder optimization.
4525+
- If you observe performance regressions or unstable execution plans after enabling this variable, set it to `OFF` to disable this feature.
4526+
- To ensure the evaluation semantics of expressions remain unchanged, the optimizer does not perform condition pushdown even when this variable is enabled if the filter conditions contain non-deterministic functions or functions with side effects (such as `RAND()`).
4527+
45174528
### tidb_opt_limit_push_down_threshold
45184529

45194530
- Scope: SESSION | GLOBAL

0 commit comments

Comments
 (0)