diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2019-01-23 15:49:49 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2019-01-23 15:52:21 +0300 |
commit | b7a784ae259c0fd8ed1adc88b84dcdaa2441987c (patch) | |
tree | 2e21a1c297d443e32c57ea1923909377610fd58b /mysql-test/main/range_vs_index_merge.test | |
parent | 36a2a185fe18d31a644da46cfabd9757a379280c (diff) | |
download | mariadb-git-b7a784ae259c0fd8ed1adc88b84dcdaa2441987c.tar.gz |
MDEV-17761: Odd optimizer choice with ORDER BY LIMIT and condition selectivity
Make the "ORDER BY ... LIMIT n" optimizer take into account condition
selectivity data from EITS (not just from potential range accesses).
Diffstat (limited to 'mysql-test/main/range_vs_index_merge.test')
-rw-r--r-- | mysql-test/main/range_vs_index_merge.test | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/main/range_vs_index_merge.test b/mysql-test/main/range_vs_index_merge.test index 84b87579e85..762fb481b39 100644 --- a/mysql-test/main/range_vs_index_merge.test +++ b/mysql-test/main/range_vs_index_merge.test @@ -718,6 +718,23 @@ SELECT * FROM City ORDER BY Population LIMIT 5; SHOW STATUS LIKE 'Handler_read_%'; +set @tmp_mdev585=@@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=1; +--replace_column 9 # +EXPLAIN +SELECT * FROM City + WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) + AND (Population >= 100000 AND Population < 120000) +ORDER BY Population LIMIT 5; + +FLUSH STATUS; +SELECT * FROM City + WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) + AND (Population >= 100000 AND Population < 120000) +ORDER BY Population LIMIT 5; +SHOW STATUS LIKE 'Handler_read_%'; + +set optimizer_use_condition_selectivity=@tmp_mdev585; set optimizer_switch='index_merge=off'; |