From c0532653abaa75a20aae1ff50142c266853ffa8d Mon Sep 17 00:00:00 2001 From: tpp Date: Sun, 13 Apr 2025 15:47:34 -0700 Subject: [PATCH 1/3] planner: add optimizer cost factors --- system-variables.md | 153 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/system-variables.md b/system-variables.md index 27d4fec816dbc..2d26afc3417aa 100644 --- a/system-variables.md +++ b/system-variables.md @@ -4698,6 +4698,159 @@ SHOW WARNINGS; - Default value: `OFF` - This variable is used to control whether to allow `INSERT`, `REPLACE`, and `UPDATE` statements to operate on the `_tidb_rowid` column. This variable can be used only when you import data using TiDB tools. +### tidb_opt_hash_agg_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_hash_join_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_index_join_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_index_lookup_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_index_merge_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_index_reader_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_index_scan_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_limit_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_merge_join_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_sort_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_stream_agg_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_table_fulL_scan_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_table_range_scan_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_table_reader_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_table_rowid_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_table_tiflash_scan_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + +### tidb_opt_topn_cost_factor New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes +- Type: Float +- Range: `[0, 2147483647]` +- Default value: `1` +- This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. + ### tidb_optimizer_selectivity_level - Scope: SESSION From b286347bb9c7ef3f586457c2e7997693c886a5e1 Mon Sep 17 00:00:00 2001 From: tpp <146148086+terry1purcell@users.noreply.github.com> Date: Sun, 13 Apr 2025 15:50:43 -0700 Subject: [PATCH 2/3] Update system-variables.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 2d26afc3417aa..35af6e2ce30bf 100644 --- a/system-variables.md +++ b/system-variables.md @@ -4797,7 +4797,7 @@ SHOW WARNINGS; - Default value: `1` - This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. -### tidb_opt_table_fulL_scan_cost_factor New in v9.0.0 +### tidb_opt_table_full_scan_cost_factor New in v9.0.0 - Scope: SESSION | GLOBAL - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes From f0502d088abec7bfe84a2423516ceeb49eff73af Mon Sep 17 00:00:00 2001 From: tpp Date: Fri, 25 Apr 2025 12:17:24 -0700 Subject: [PATCH 3/3] typo --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 2d26afc3417aa..35af6e2ce30bf 100644 --- a/system-variables.md +++ b/system-variables.md @@ -4797,7 +4797,7 @@ SHOW WARNINGS; - Default value: `1` - This variable is internally used in the Cost Model, and it is NOT recommended to modify its value unless directed by TiDB Optimizer Engineering. -### tidb_opt_table_fulL_scan_cost_factor New in v9.0.0 +### tidb_opt_table_full_scan_cost_factor New in v9.0.0 - Scope: SESSION | GLOBAL - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes