1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-34993, part2: backport optimizer_adjust_secondary_key_costs

...and make the fix for MDEV-34993 switchable. It is enabled by default
and controlled with @optimizer_adjust_secondary_key_costs=fix_card_multiplier
This commit is contained in:
Sergei Petrunia
2024-09-24 10:23:34 +03:00
parent 8166a5d33d
commit 1cda4726ca
9 changed files with 175 additions and 1 deletions

View File

@@ -3521,7 +3521,9 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
multiplied by quick_cond_selectivity above, so we will only
multiply it with selectivity_mult).
*/
if (selectivity_mult > 1.0 / quick_cond_selectivity)
if ((thd->variables.optimizer_adjust_secondary_key_costs &
OPTIMIZER_ADJ_FIX_CARD_MULT) &&
selectivity_mult > 1.0 / quick_cond_selectivity)
{
selectivity_for_index.add("note", "multiplier too high, clipping");
selectivity_mult= 1.0/quick_cond_selectivity;