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

MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins

Continuation of the fix: Make condition selectivity estimate use the
right estimate, too.
This commit is contained in:
Sergei Petrunia
2018-10-23 13:17:14 +02:00
parent 3b6d903852
commit 14b62b1578
3 changed files with 60 additions and 3 deletions

View File

@ -2060,6 +2060,29 @@ explain select * from t1 left join t3 on t1.a=t3.b and t3.a<5;
--echo # This must use range for table t3, too:
explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
--echo #
--echo # .. part 2: make sure condition selectivity can use the condition too.
--echo #
alter table t3 drop key a;
set @tmp1=@@optimizer_use_condition_selectivity;
set @tmp2=@@use_stat_tables;
set @tmp3=@@histogram_size;
set use_stat_tables=preferably;
set optimizer_use_condition_selectivity=4;
set histogram_size=100;
analyze table t3 persistent for all;
--echo # t3.filtered is less than 100%:
explain extended select * from t1 left join t3 on t1.a=t3.b and t3.a<5;
--echo # t3.filtered must less than 100%, too:
explain extended select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
drop table t1,t2,t3;
set optimizer_use_condition_selectivity= @tmp1;
set use_stat_tables= @tmp2;
set histogram_size= @tmp3;
SET optimizer_switch=@save_optimizer_switch;