mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-6384: It seems like OPTIMIZER take into account the order of indexes in the table
When ORDER BY ... LIMIT check whether it should switch from index IDX1 to index IDX2, it should not ignore the fact that IDX2 may have a potential range or ref(const) access. Istead, it should calculate their costs: there is now a saved range optimizer cost and code to re-calculate what best_access_path() calculated for ref(const). /* in current cost model these two can be very different numbers unfortunately */
This commit is contained in:
@@ -1002,7 +1002,7 @@ insert into t2 (b) values (null), (null), (null);
|
||||
set optimizer_switch='extended_keys=on';
|
||||
explain select a from t1 where b is null order by a desc limit 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref b b 9 const 2 Using where; Using filesort
|
||||
1 SIMPLE t1 index b PRIMARY 8 NULL 3 Using where
|
||||
select a from t1 where b is null order by a desc limit 2;
|
||||
a
|
||||
3
|
||||
|
||||
Reference in New Issue
Block a user