mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Range optimizer fix:
If cost(full_scan_on_shortest_covering_index) < cost(best_range_scan) < cost(full_table_scan) use full_scan_on_shortest_covering_index (before this fix best_range_scan was used)
This commit is contained in:
@ -318,11 +318,11 @@ create table t2 (a int, b int, primary key (a));
|
||||
insert into t2 values (1,7),(2,7);
|
||||
explain select a from t2 where a>1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
explain select a from (select a from t2 where a>1) tt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
2 DERIVED t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
drop table t2;
|
||||
CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) NOT NULL default '', `vendor` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `price` decimal(12,2) NOT NULL default '0.00', PRIMARY KEY (`itemid`,`grpid`,`vendor`,`date_`), KEY `itemid` (`itemid`,`vendor`), KEY `itemid_2` (`itemid`,`date_`));
|
||||
insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10);
|
||||
|
Reference in New Issue
Block a user