diff options
author | unknown <sergefp@mysql.com> | 2004-06-22 04:47:28 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2004-06-22 04:47:28 +0400 |
commit | cfecdcd36a2dbaba863c178d1170782c1f3e9fbc (patch) | |
tree | b87bd41117f45565a9107145e291d6bd1d0558c6 /mysql-test/r | |
parent | c4cd310f7f9088572c68f6de139a4c63baf1c3bf (diff) | |
download | mariadb-git-cfecdcd36a2dbaba863c178d1170782c1f3e9fbc.tar.gz |
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)
Diffstat (limited to 'mysql-test/r')
-rw-r--r-- | mysql-test/r/ctype_ucs.result | 4 | ||||
-rw-r--r-- | mysql-test/r/derived.result | 4 | ||||
-rw-r--r-- | mysql-test/r/func_group.result | 6 | ||||
-rw-r--r-- | mysql-test/r/func_like.result | 4 | ||||
-rw-r--r-- | mysql-test/r/heap.result | 2 | ||||
-rw-r--r-- | mysql-test/r/heap_btree.result | 2 | ||||
-rw-r--r-- | mysql-test/r/heap_hash.result | 2 | ||||
-rw-r--r-- | mysql-test/r/join_outer.result | 2 | ||||
-rw-r--r-- | mysql-test/r/key.result | 4 | ||||
-rw-r--r-- | mysql-test/r/null_key.result | 6 | ||||
-rw-r--r-- | mysql-test/r/order_by.result | 4 | ||||
-rw-r--r-- | mysql-test/r/range.result | 6 | ||||
-rw-r--r-- | mysql-test/r/select.result | 4 |
13 files changed, 25 insertions, 25 deletions
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 30795aaf106..9b955667e69 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -53,10 +53,10 @@ create table t1 (a varchar(10) character set ucs2, key(a)); insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain select * from t1 where a like 'abc%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 21 NULL 1 Using where; Using index +1 SIMPLE t1 index a a 21 NULL 5 Using where; Using index explain select * from t1 where a like concat('abc','%'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 21 NULL 1 Using where; Using index +1 SIMPLE t1 index a a 21 NULL 5 Using where; Using index select * from t1 where a like "abc%"; a abc diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index dd4c32403b5..c374a334d3d 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -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); diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 8033e529c56..453110dc305 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -572,11 +572,11 @@ AME AME explain select min(a1) from t1 where a1 > 'KKK' or a1 < 'XXX'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 0 NULL 15 Using where; Using index +1 SIMPLE t1 index PRIMARY PRIMARY 3 NULL 14 Using where; Using index explain select min(a1) from t1 where a1 != 'KKK'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 3 NULL 14 Using where; Using index +1 SIMPLE t1 index PRIMARY PRIMARY 3 NULL 14 Using where; Using index explain select max(a3) from t1 where a2 < 2 and a3 < 'SEA'; id select_type table type possible_keys key key_len ref rows Extra @@ -584,7 +584,7 @@ id select_type table type possible_keys key key_len ref rows Extra explain select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range k1 k1 7 NULL 1 Using where; Using index +1 SIMPLE t1 ref k1 k1 3 const 2 Using where; Using index 1 SIMPLE t2 range k1 k1 3 NULL 4 Using where; Using index explain select min(a4 - 0.01) from t1; diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result index 75692738caf..d4819cbe949 100644 --- a/mysql-test/r/func_like.result +++ b/mysql-test/r/func_like.result @@ -3,10 +3,10 @@ create table t1 (a varchar(10), key(a)); insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain select * from t1 where a like 'abc%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 11 NULL 1 Using where; Using index +1 SIMPLE t1 index a a 11 NULL 5 Using where; Using index explain select * from t1 where a like concat('abc','%'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 11 NULL 1 Using where; Using index +1 SIMPLE t1 index a a 11 NULL 5 Using where; Using index select * from t1 where a like "abc%"; a abc diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index c3fbd73ac42..6100301b2c6 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -66,7 +66,7 @@ a alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index +1 SIMPLE t1 index uniq_id uniq_id 4 NULL 4 Using where; Using index drop table t1; create table t1 (x int not null, y int not null, key x (x), unique y (y)) engine=heap; diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result index 5c60c97d674..03625d19d04 100644 --- a/mysql-test/r/heap_btree.result +++ b/mysql-test/r/heap_btree.result @@ -66,7 +66,7 @@ a alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index +1 SIMPLE t1 index uniq_id uniq_id 4 NULL 4 Using where; Using index drop table t1; create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y)) engine=heap; diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result index 7affbf788fb..ba02328d1ba 100644 --- a/mysql-test/r/heap_hash.result +++ b/mysql-test/r/heap_hash.result @@ -66,7 +66,7 @@ a alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index +1 SIMPLE t1 index uniq_id uniq_id 4 NULL 4 Using where; Using index drop table t1; create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y)) engine=heap; diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 9d7c3d98952..6e0afd75a33 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -634,7 +634,7 @@ insert into t2 values (10,1),(20,2),(30,3); explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 2 const 1 Using where; Using index +1 SIMPLE t1 eq_ref PRIMARY PRIMARY 2 const 1 Using index select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; fooID barID fooID 10 1 NULL diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index 28824de94ce..2ea60114066 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -213,14 +213,14 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index explain select 1 from t1 where id =2 or id=3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 7 Using where; Using index explain select name from t1 where id =2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 ALTER TABLE t1 DROP PRIMARY KEY, ADD INDEX (id); explain select 1 from t1 where id =2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref id id 4 const 1 Using where; Using index +1 SIMPLE t1 ref id id 4 const 1 Using index drop table t1; CREATE TABLE t1 (numeropost mediumint(8) unsigned NOT NULL default '0', numreponse int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (numeropost,numreponse), UNIQUE KEY numreponse (numreponse)); INSERT INTO t1 (numeropost,numreponse) VALUES ('1','1'),('1','2'),('2','3'),('2','4'); diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index e57ac321f46..11413204950 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -30,13 +30,13 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 9 NULL 2 Using where; Using index +1 SIMPLE t1 ref a,b a 5 const 2 Using where; Using index explain select * from t1 where a > 1 and a < 3 limit 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index +1 SIMPLE t1 index a a 9 NULL 12 Using where; Using index explain select * from t1 where a > 8 and a < 9; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index +1 SIMPLE t1 index a a 9 NULL 12 Using where; Using index select * from t1 where a is null; a b NULL 7 diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 694dc26bcde..6b03dc239e7 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -272,7 +272,7 @@ create table t1 (a int not null, b int, c varchar(10), key (a, b, c)); insert into t1 values (1, NULL, NULL), (1, NULL, 'b'), (1, 1, NULL), (1, 1, 'b'), (1, 1, 'b'), (2, 1, 'a'), (2, 1, 'b'), (2, 2, 'a'), (2, 2, 'b'), (2, 3, 'c'),(1,3,'b'); explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 20 NULL 2 Using where; Using index +1 SIMPLE t1 index a a 20 NULL 11 Using where; Using index select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc; a b c 1 NULL b @@ -328,7 +328,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index explain select * from t1 where a = 2 and b < 2 order by a desc,b desc; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 9 NULL 2 Using where; Using index +1 SIMPLE t1 ref a a 4 const 2 Using where; Using index explain select * from t1 where a = 1 order by b desc; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref a a 4 const 5 Using where; Using index diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 290e72d3b55..244dcbd03d4 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -244,10 +244,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range x x 5 NULL 2 Using where explain select count(*) from t1 where x in (1); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range x x 5 NULL 1 Using where; Using index +1 SIMPLE t1 index x x 5 NULL 9 Using where; Using index explain select count(*) from t1 where x in (1,2); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range x x 5 NULL 2 Using where; Using index +1 SIMPLE t1 index x x 5 NULL 9 Using where; Using index drop table t1; CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1)); INSERT INTO t1 VALUES (0),(0),(1),(1); @@ -255,7 +255,7 @@ CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya)); INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2); explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref j1 j1 4 const 1 Using where; Using index +1 SIMPLE t2 ref j1 j1 4 const 1 Using index 1 SIMPLE t1 ALL i1 NULL NULL NULL 4 Range checked for each record (index map: 0x1) DROP TABLE t1,t2; CREATE TABLE t1 ( diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 73e747386ab..bdc64967d3d 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2150,10 +2150,10 @@ a a a select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 on t1.a>1; a a a 1 1 2 -1 1 3 2 2 2 -2 2 3 3 3 2 +1 1 3 +2 2 3 3 3 3 select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1; a a a |