1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-35074: selectivity_notembedded fails with --view-protocol

Make the test view-protocol proof: save the contents of optimizer_trace
and then we can do many queries against it.

Also removed end-of-line spaces.
This commit is contained in:
Sergei Petrunia
2024-10-04 12:49:37 +03:00
parent e9c999caf4
commit 5673cbe094
3 changed files with 73 additions and 52 deletions

View File

@ -233,50 +233,59 @@ create table t1 (
);
insert into t1
select
select
seq, FLOOR(seq/100), 'filler'
from
from
seq_1_to_1000;
analyze table t1;
set optimizer_trace=1;
explain select * from t1
explain select * from t1
where
pk in (1,2,3,4,5) and
key1 <= 4;
create temporary table opt_trace as
select * from information_schema.optimizer_trace;
--echo # 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;
--echo # 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;
drop table opt_trace;
--echo # 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;
drop table t1;
create temporary table opt_trace as
select * from information_schema.optimizer_trace;
--echo # 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;
--echo # Includes 1.79...e308 as cost:
select
select
json_detailed(json_extract(trace,'$**.best_access_path')) as JS
from
information_schema.optimizer_trace;
set optimizer_adjust_secondary_key_costs=default;
from
opt_trace;
drop table opt_trace;
set optimizer_adjust_secondary_key_costs=default;
drop table t1;
--echo #
--echo # Clean up
--echo #