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:
parent
e9c999caf4
commit
5673cbe094
@ -233,11 +233,13 @@ 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 where
|
||||
create temporary table opt_trace as
|
||||
select * from information_schema.optimizer_trace;
|
||||
# Must have a note that "multiplier is too high":
|
||||
select
|
||||
json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
opt_trace;
|
||||
JS
|
||||
[
|
||||
[
|
||||
@ -258,7 +260,7 @@ JS
|
||||
select
|
||||
json_detailed(json_extract(trace,'$**.best_access_path')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
opt_trace;
|
||||
JS
|
||||
[
|
||||
{
|
||||
@ -280,6 +282,7 @@ JS
|
||||
}
|
||||
}
|
||||
]
|
||||
drop table opt_trace;
|
||||
# Disable the fix and try the same:
|
||||
set @@optimizer_adjust_secondary_key_costs='';
|
||||
explain select * from t1
|
||||
@ -288,12 +291,13 @@ 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 where
|
||||
drop table t1;
|
||||
create temporary table opt_trace as
|
||||
select * from information_schema.optimizer_trace;
|
||||
# Shows a high multiplier, without a "note":
|
||||
select
|
||||
json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
opt_trace;
|
||||
JS
|
||||
[
|
||||
[
|
||||
@ -312,7 +316,7 @@ JS
|
||||
select
|
||||
json_detailed(json_extract(trace,'$**.best_access_path')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
opt_trace;
|
||||
JS
|
||||
[
|
||||
{
|
||||
@ -334,7 +338,9 @@ JS
|
||||
}
|
||||
}
|
||||
]
|
||||
drop table opt_trace;
|
||||
set optimizer_adjust_secondary_key_costs=default;
|
||||
drop table t1;
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
|
@ -228,11 +228,13 @@ 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
|
||||
json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
opt_trace;
|
||||
JS
|
||||
[
|
||||
[
|
||||
@ -253,7 +255,7 @@ JS
|
||||
select
|
||||
json_detailed(json_extract(trace,'$**.best_access_path')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
opt_trace;
|
||||
JS
|
||||
[
|
||||
{
|
||||
@ -275,6 +277,7 @@ JS
|
||||
}
|
||||
}
|
||||
]
|
||||
drop table opt_trace;
|
||||
# Disable the fix and try the same:
|
||||
set @@optimizer_adjust_secondary_key_costs='';
|
||||
explain select * from t1
|
||||
@ -283,12 +286,13 @@ 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
|
||||
json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
opt_trace;
|
||||
JS
|
||||
[
|
||||
[
|
||||
@ -307,7 +311,7 @@ JS
|
||||
select
|
||||
json_detailed(json_extract(trace,'$**.best_access_path')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
opt_trace;
|
||||
JS
|
||||
[
|
||||
{
|
||||
@ -329,7 +333,9 @@ JS
|
||||
}
|
||||
}
|
||||
]
|
||||
drop table opt_trace;
|
||||
set optimizer_adjust_secondary_key_costs=default;
|
||||
drop table t1;
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
|
@ -245,17 +245,21 @@ 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
|
||||
json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
opt_trace;
|
||||
|
||||
--echo # Must not include 1.79...e308 as cost:
|
||||
select
|
||||
json_detailed(json_extract(trace,'$**.best_access_path')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
opt_trace;
|
||||
drop table opt_trace;
|
||||
|
||||
--echo # Disable the fix and try the same:
|
||||
set @@optimizer_adjust_secondary_key_costs='';
|
||||
@ -263,20 +267,25 @@ 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
|
||||
json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
opt_trace;
|
||||
|
||||
--echo # Includes 1.79...e308 as cost:
|
||||
select
|
||||
json_detailed(json_extract(trace,'$**.best_access_path')) as JS
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
set optimizer_adjust_secondary_key_costs=default;
|
||||
opt_trace;
|
||||
drop table opt_trace;
|
||||
|
||||
set optimizer_adjust_secondary_key_costs=default;
|
||||
drop table t1;
|
||||
--echo #
|
||||
--echo # Clean up
|
||||
--echo #
|
||||
|
Loading…
x
Reference in New Issue
Block a user