diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2019-08-15 12:57:21 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2019-08-15 12:57:21 +0300 |
commit | 1c75ad6eed744672fdce77b0752801b67edb69f8 (patch) | |
tree | 77b4c8a41e0a3fc00e5b4d9e159410fac17878a2 /mysql-test/t/selectivity.test | |
parent | 588e67956af5c21191189f669f11f083e8ae35f7 (diff) | |
download | mariadb-git-1c75ad6eed744672fdce77b0752801b67edb69f8.tar.gz |
MDEV-19834 Selectivity of an equality condition discounted twice
When discounting selectivity of ref access, don't discount the
selectivity we've already discounted for range access.
The 10.1 version of the fix. Will need to adjust condition filtering
test results in 10.4
Diffstat (limited to 'mysql-test/t/selectivity.test')
-rw-r--r-- | mysql-test/t/selectivity.test | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test index 3df49456332..f1c9d6b31b8 100644 --- a/mysql-test/t/selectivity.test +++ b/mysql-test/t/selectivity.test @@ -1,4 +1,5 @@ --source include/have_stat_tables.inc +--source include/have_sequence.inc --disable_warnings drop table if exists t0,t1,t2,t3; @@ -1102,3 +1103,26 @@ set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectiv drop table t1; drop function f1; +--echo # +--echo # MDEV-19834 Selectivity of an equality condition discounted twice +--echo # +set @@optimizer_use_condition_selectivity=4; +set @@use_stat_tables='preferably'; +create table t1 (a int, b int, key (b), key (a)); +insert into t1 +select (rand(1)*1000)/10, (rand(1001)*1000)/50 from seq_1_to_1000; +analyze table t1 ; + +--echo # Check what info the optimizer has about selectivities +explain extended select * from t1 use index () where a in (17,51,5); +explain extended select * from t1 use index () where b=2; + +--echo # Now, the equality is used for ref access, while the range condition +--echo # gives selectivity data +explain extended select * from t1 where a in (17,51,5) and b=2; +drop table t1; + +set use_stat_tables= @save_use_stat_tables; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +--echo # End of 10.1 tests + |