1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge branch '10.6' into 10.11

This commit is contained in:
Oleksandr Byelkin
2024-10-29 15:24:38 +01:00
655 changed files with 8060 additions and 3541 deletions

View File

@ -225,26 +225,28 @@ index (key1, pk),
primary key (pk)
);
insert into t1
select
select
seq, FLOOR(seq/100), 'filler'
from
from
seq_1_to_1000;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
set optimizer_trace=1;
explain select * from t1
explain select * from t1
where
pk in (1,2,3,4,5) and
key1 <= 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using index condition; Using where
create temporary table opt_trace as
select * from information_schema.optimizer_trace;
# Must have a note that "multiplier is too high":
select
select
json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS
from
information_schema.optimizer_trace;
from
opt_trace;
JS
[
[
@ -255,15 +257,17 @@ JS
{
"index_name": "key1",
"selectivity_from_index": 0.391,
"selectivity_multiplier": 90.9091
"selectivity_multiplier": 90.9091,
"note": "multiplier too high, clipping",
"clipped_multiplier": 2.557544757
}
]
]
# Must not include 1.79...e308 as cost:
select
select
json_detailed(json_extract(trace,'$**.best_access_path')) as JS
from
information_schema.optimizer_trace;
from
opt_trace;
JS
[
{
@ -272,34 +276,36 @@ JS
[
{
"access_type": "range",
"resulting_rows": 177.7272905,
"cost": 1.79769e308,
"resulting_rows": 5,
"cost": 6.647684891,
"chosen": true
}
],
"chosen_access_method":
{
"type": "range",
"records": 177.7272905,
"cost": 1.79769e308,
"records": 5,
"cost": 6.647684891,
"uses_join_buffering": false
}
}
]
drop table opt_trace;
# Disable the fix and try the same:
set @@optimizer_adjust_secondary_key_costs='';
explain select * from t1
explain select * from t1
where
pk in (1,2,3,4,5) and
key1 <= 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using index condition; Using where
drop table t1;
create temporary table opt_trace as
select * from information_schema.optimizer_trace;
# Shows a high multiplier, without a "note":
select
select
json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS
from
information_schema.optimizer_trace;
from
opt_trace;
JS
[
[
@ -315,10 +321,10 @@ JS
]
]
# Includes 1.79...e308 as cost:
select
select
json_detailed(json_extract(trace,'$**.best_access_path')) as JS
from
information_schema.optimizer_trace;
from
opt_trace;
JS
[
{
@ -341,7 +347,9 @@ JS
}
}
]
drop table opt_trace;
set optimizer_adjust_secondary_key_costs=default;
drop table t1;
#
# Clean up
#