[MDEV-27549] Add optimizer_switch_disabled to show disabled optimizations Created: 2022-01-19  Updated: 2023-12-22

Status: Open
Project: MariaDB Server
Component/s: Optimizer
Fix Version/s: 11.5

Type: Task Priority: Major
Reporter: Sergei Petrunia Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

@@optimizer_switch has a lot (currently 36) flags. Most of them should be enabled most of the time (ideally we should have all optimizations enabled).

Currently, it is not easy to check which optimizations are disabled. The idea is to add a @@optimizer_switch_disabled variable which is a view of @@optimizer_switch which lists only the disabled optimizations.

The variable should be read-only. It should not be possible to specify it in my.cnf.

The first user will be the crash reporter. Currently, it prints the value of @@optimizer_switch. It should print @@optimizer_switch_disabled instead.



 Comments   
Comment by Elena Stepanova [ 2022-01-19 ]

The first user will be the crash reporter. Currently, it prints the value of @@optimizer_switch. It should print @@optimizer_switch_disabled instead.

Please don't do it.
For crashes the enabled switches are much more important than the disabled ones. And if you do this, to retrieve the list of enabled optimizations after a crash one will need to run the exact version where the crash occurred, get the full list of switches available in that version, and subtract your disabled list from it. It is not even always possible, since there are custom versions/builds with backported/experimental switches, and when it is possible, it is an unreasonably bigger effort comparing to current effort of checking which optimizations are disabled which you are trying to eliminate ("copy-paste the full switch and search for =off")

Comment by Sergei Golubchik [ 2022-01-19 ]

it'd be much simpler to add a view to sys schema that prints all optimizations, one per row, with "ENABLED/DISABLED" in the second column. Or a view that prints only disabled optimizations.

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