Skip to content

Commit 89493a9

Browse files
committed
MDEV-34993: fix merge into 10.6: OPTIMIZER_ADJ_FIX_CARD_MULT should be ON by default
1 parent a4d2cc9 commit 89493a9

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed

mysql-test/main/mysqld--help.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ old-alter-table DEFAULT
17091709
old-mode UTF8_IS_UTF8MB3
17101710
old-passwords FALSE
17111711
old-style-user-limits FALSE
1712-
optimizer-adjust-secondary-key-costs fix_reuse_range_for_ref
1712+
optimizer-adjust-secondary-key-costs fix_reuse_range_for_ref,fix_card_multiplier
17131713
optimizer-join-limit-pref-ratio 0
17141714
optimizer-max-sel-arg-weight 32000
17151715
optimizer-max-sel-args 16000

mysql-test/main/secondary_key_costs.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ json_detailed(json_extract(@trace, '$**.considered_access_paths'))
8282
drop table t1, name, flag2;
8383
select @@optimizer_adjust_secondary_key_costs;
8484
@@optimizer_adjust_secondary_key_costs
85-
fix_reuse_range_for_ref
85+
fix_reuse_range_for_ref,fix_card_multiplier
8686
set @@optimizer_adjust_secondary_key_costs=7;
8787
select @@optimizer_adjust_secondary_key_costs;
8888
@@optimizer_adjust_secondary_key_costs

mysql-test/main/selectivity_innodb_notembedded.result

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ JS
250250
{
251251
"index_name": "key1",
252252
"selectivity_from_index": 0.399,
253-
"selectivity_multiplier": 90.9091
253+
"selectivity_multiplier": 90.9091,
254+
"note": "multiplier too high, clipping",
255+
"clipped_multiplier": 2.506265664
254256
}
255257
]
256258
]
@@ -266,16 +268,16 @@ JS
266268
[
267269
{
268270
"access_type": "range",
269-
"resulting_rows": 181.3636545,
270-
"cost": 1.79769e308,
271+
"resulting_rows": 5,
272+
"cost": 6.83879845,
271273
"chosen": true
272274
}
273275
],
274276
"chosen_access_method":
275277
{
276278
"type": "range",
277-
"records": 181.3636545,
278-
"cost": 1.79769e308,
279+
"records": 5,
280+
"cost": 6.83879845,
279281
"uses_join_buffering": false
280282
}
281283
}

mysql-test/main/selectivity_notembedded.result

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ JS
245245
{
246246
"index_name": "key1",
247247
"selectivity_from_index": 0.391,
248-
"selectivity_multiplier": 90.9091
248+
"selectivity_multiplier": 90.9091,
249+
"note": "multiplier too high, clipping",
250+
"clipped_multiplier": 2.557544757
249251
}
250252
]
251253
]
@@ -261,16 +263,16 @@ JS
261263
[
262264
{
263265
"access_type": "range",
264-
"resulting_rows": 177.7272905,
265-
"cost": 1.79769e308,
266+
"resulting_rows": 5,
267+
"cost": 6.647684891,
266268
"chosen": true
267269
}
268270
],
269271
"chosen_access_method":
270272
{
271273
"type": "range",
272-
"records": 177.7272905,
273-
"cost": 1.79769e308,
274+
"records": 5,
275+
"cost": 6.647684891,
274276
"uses_join_buffering": false
275277
}
276278
}

sql/sql_priv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@
278278
#define OPTIMIZER_ADJ_FIX_REUSE_RANGE_FOR_REF (16)
279279
#define OPTIMIZER_ADJ_FIX_CARD_MULT (32)
280280

281+
#define OPTIMIZER_ADJ_DEFAULT (OPTIMIZER_ADJ_FIX_REUSE_RANGE_FOR_REF | \
282+
OPTIMIZER_ADJ_FIX_CARD_MULT)
281283
/*
282284
Replication uses 8 bytes to store SQL_MODE in the binary log. The day you
283285
use strictly more than 64 bits by adding one more define above, you should

sql/sys_vars.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2860,7 +2860,7 @@ static Sys_var_set Sys_optimizer_adjust_secondary_key_costs(
28602860
"This variable will be deleted in MariaDB 11.0 as it is not needed with the "
28612861
"new 11.0 optimizer.",
28622862
SESSION_VAR(optimizer_adjust_secondary_key_costs), CMD_LINE(REQUIRED_ARG),
2863-
adjust_secondary_key_cost, DEFAULT(OPTIMIZER_ADJ_FIX_REUSE_RANGE_FOR_REF));
2863+
adjust_secondary_key_cost, DEFAULT(OPTIMIZER_ADJ_DEFAULT));
28642864

28652865

28662866
static Sys_var_charptr_fscs Sys_pid_file(

0 commit comments

Comments
 (0)