[MDEV-26639] Docs for optimizer_switch are incomplete, not all available values are listed Created: 2021-09-18  Updated: 2022-05-11  Resolved: 2022-05-11

Status: Closed
Project: MariaDB Server
Component/s: Documentation
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Otto Kekäläinen Assignee: Ian Gilfillan
Resolution: Fixed Votes: 0
Labels: Documentation, docs, documentation


 Description   

The docs at https://mariadb.com/kb/en/server-system-variables/#optimizer_switch lists most of the possible values for `optimizer_switch`, but some are missing.

At least condition_pushdown_from_having and in_to_exists are valid values in MariaDB 10.5 but the docs page does not mention them.

For reference, here are all possible values for current stable MariaDB releases:

$ for x in 10.{2..5}; do git grep optimizer_switch $x -- traces/SHOW-VARIABLES.list; done
 
10.2:traces/SHOW-VARIABLES.list:optimizer_switch       index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on
 
10.3:traces/SHOW-VARIABLES.list:optimizer_switch       index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on
 
10.4:traces/SHOW-VARIABLES.list:optimizer_switch       index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
 
10.5:traces/SHOW-VARIABLES.list:optimizer_switch       index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off

Maybe greenman could review them?

(side note: why are there 3 labels for documentation?)



 Comments   
Comment by Ian Gilfillan [ 2021-09-18 ]

Thanks for the report. Labels tend to grow over time as people add them, much like tags in a post, but a better choice is the Documentation component, which is usually automatically assigned to me.

Comment by Otto Kekäläinen [ 2021-09-18 ]

As a side note, do we have some system that can automatically print
out all allowed values of the system variables? Running `mariabd
--help --verbose` lists some help text and all the system variable
names.

I'd like to know if there is something that can list not just the
system variable names and the allowed values. It would also make
your job of cross-checking the docs easier.

Comment by Ian Gilfillan [ 2021-09-18 ]

Only in_to_exists was listed on the server variable page, although both were listed as options on the https://mariadb.com/kb/en/optimizer-switch/ page. Neither are described in any meaningful way, so will leave this issue open until they are.

Comment by Ian Gilfillan [ 2021-09-18 ]

You can use the Information Schema to view permitted values, for example:

SELECT * FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'optimizer_sw%'\G

Generated at Thu Feb 08 09:46:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.