summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2002-10-03 18:47:04 +0300
committerunknown <bell@sanja.is.com.ua>2002-10-03 18:47:04 +0300
commitf094b6af4c5c32bfda7f74461d47675ab61722a0 (patch)
treea10d91a6ce2aa4dc6b0104292912675442cafafb
parentc9a2b58986635015b3f3867999ef3fafa2bd2728 (diff)
downloadmariadb-git-f094b6af4c5c32bfda7f74461d47675ab61722a0.tar.gz
fixing EXPLAIN select types
-rw-r--r--mysql-test/r/compare.result2
-rw-r--r--mysql-test/r/create.result2
-rw-r--r--mysql-test/r/distinct.result24
-rw-r--r--mysql-test/r/explain.result10
-rw-r--r--mysql-test/r/group_by.result10
-rw-r--r--mysql-test/r/heap.result16
-rw-r--r--mysql-test/r/heap_btree.result22
-rw-r--r--mysql-test/r/heap_hash.result16
-rw-r--r--mysql-test/r/innodb.result26
-rw-r--r--mysql-test/r/join_outer.result30
-rw-r--r--mysql-test/r/key_diff.result4
-rw-r--r--mysql-test/r/key_primary.result4
-rw-r--r--mysql-test/r/merge.result6
-rw-r--r--mysql-test/r/myisam.result16
-rw-r--r--mysql-test/r/null_key.result52
-rw-r--r--mysql-test/r/odbc.result2
-rw-r--r--mysql-test/r/order_by.result56
-rw-r--r--mysql-test/r/range.result2
-rw-r--r--mysql-test/r/select.result42
-rw-r--r--mysql-test/r/subselect.result8
-rw-r--r--mysql-test/r/type_datetime.result2
-rw-r--r--mysql-test/r/union.result10
-rw-r--r--mysql-test/r/user_var.result8
-rw-r--r--mysql-test/r/varbinary.result2
-rw-r--r--sql/sql_parse.cc4
25 files changed, 189 insertions, 187 deletions
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
index be11de8ebb9..10f149e7a9b 100644
--- a/mysql-test/r/compare.result
+++ b/mysql-test/r/compare.result
@@ -3,7 +3,7 @@ CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
insert into t1 values ('000000000001'),('000000000002');
explain select * from t1 where id=000000000001;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index PRIMARY PRIMARY 12 NULL 2 where used; Using index
+1 SIMPLE t1 index PRIMARY PRIMARY 12 NULL 2 where used; Using index
select * from t1 where id=000000000001;
id
000000000001
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 41a977695a6..625ef684698 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -63,7 +63,7 @@ insert into t1 (b) values ("hello"),("my"),("world");
create table t2 (key (b)) select * from t1;
explain select * from t2 where b="world";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 ref B B 21 const 1 where used
+1 SIMPLE t2 ref B B 21 const 1 where used
select * from t2 where b="world";
a B
3 world
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index d8386ddcfc3..5848e583d7e 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -173,9 +173,9 @@ INSERT INTO t2 values (1),(2),(3);
INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t3 index a a 5 NULL 6 Using index; Using temporary
-1 FIRST t2 index a a 4 NULL 5 Using index; Distinct
-1 FIRST t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 where used; Distinct
+1 SIMPLE t3 index a a 5 NULL 6 Using index; Using temporary
+1 SIMPLE t2 index a a 4 NULL 5 Using index; Distinct
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 where used; Distinct
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
@@ -189,8 +189,8 @@ insert into t4 select * from t3;
insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary
-1 FIRST t3 ref a a 5 t1.a 10 Using index; Distinct
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary
+1 SIMPLE t3 ref a a 5 t1.a 10 Using index; Distinct
select distinct t1.a from t1,t3 where t1.a=t3.a;
a
1
@@ -275,13 +275,13 @@ WHERE
((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index id id 4 NULL 2 Using index; Using temporary
-1 FIRST t2 index id id 8 NULL 1 Using index; Distinct
-1 FIRST t3 index id id 8 NULL 1 Using index; Distinct
-1 FIRST j_lj_t2 index id id 4 NULL 2 where used; Using index; Distinct
-1 FIRST t2_lj index id id 8 NULL 1 where used; Using index; Distinct
-1 FIRST j_lj_t3 index id id 4 NULL 2 where used; Using index; Distinct
-1 FIRST t3_lj index id id 8 NULL 1 where used; Using index; Distinct
+1 SIMPLE t1 index id id 4 NULL 2 Using index; Using temporary
+1 SIMPLE t2 index id id 8 NULL 1 Using index; Distinct
+1 SIMPLE t3 index id id 8 NULL 1 Using index; Distinct
+1 SIMPLE j_lj_t2 index id id 4 NULL 2 where used; Using index; Distinct
+1 SIMPLE t2_lj index id id 8 NULL 1 where used; Using index; Distinct
+1 SIMPLE j_lj_t3 index id id 4 NULL 2 where used; Using index; Distinct
+1 SIMPLE t3_lj index id id 8 NULL 1 where used; Using index; Distinct
SELECT DISTINCT
t1.id
from
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index cd0ddeae120..0d97aeaf531 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -10,16 +10,16 @@ id str
3 foo
explain select * from t1 where str is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref str str 11 const 1 where used
+1 SIMPLE t1 ref str str 11 const 1 where used
explain select * from t1 where str="foo";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 const str str 11 const 1
+1 SIMPLE t1 const str str 11 const 1
explain select * from t1 ignore key (str) where str="foo";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4 where used
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 where used
explain select * from t1 use key (str,str) where str="foo";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 const str str 11 const 1
+1 SIMPLE t1 const str str 11 const 1
explain select * from t1 use key (str,str,foo) where str="foo";
Key column 'foo' doesn't exist in table
explain select * from t1 ignore key (str,str,foo) where str="foo";
@@ -27,4 +27,4 @@ Key column 'foo' doesn't exist in table
drop table t1;
explain select 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST No tables used
+1 SIMPLE No tables used
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 0781468bc97..54b4e3fba6d 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -226,7 +226,7 @@ key (score)
INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3);
explain select userid,count(*) from t1 group by userid desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
select userid,count(*) from t1 group by userid desc;
userid count(*)
3 3
@@ -234,10 +234,10 @@ userid count(*)
1 2
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range spID spID 5 NULL 2 where used; Using index
+1 SIMPLE t1 range spID spID 5 NULL 2 where used; Using index
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range spID spID 5 NULL 2 where used; Using index
+1 SIMPLE t1 range spID spID 5 NULL 2 where used; Using index
select spid,count(*) from t1 where spid between 1 and 2 group by spid;
spid count(*)
1 1
@@ -248,7 +248,7 @@ spid count(*)
1 1
explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 6 Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
select sql_big_result spid,sum(userid) from t1 group by spid desc;
spid sum(userid)
5 3
@@ -258,7 +258,7 @@ spid sum(userid)
1 1
explain select sql_big_result score,count(*) from t1 group by score desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL score 3 NULL 6 Using index
+1 SIMPLE t1 index NULL score 3 NULL 6 Using index
select sql_big_result score,count(*) from t1 group by score desc;
score count(*)
3 3
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 94fac7757ac..8fe87cdda8b 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -66,7 +66,7 @@ a
alter table t1 type=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 FIRST t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
+1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
drop table t1;
create table t1 (x int not null, y int not null, key x (x), unique y (y))
type=heap;
@@ -85,8 +85,8 @@ x y x y
2 6 2 2
explain select * from t1,t1 as t2 where t1.x=t2.y;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL x NULL NULL NULL 6
-1 FIRST t2 eq_ref y y 4 t1.x 1
+1 SIMPLE t1 ALL x NULL NULL NULL 6
+1 SIMPLE t2 eq_ref y y 4 t1.x 1
drop table t1;
create table t1 (a int) type=heap;
insert into t1 values(1);
@@ -159,17 +159,17 @@ create table t1 (btn char(10) not null, key(btn)) type=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL btn NULL NULL NULL 14 where used
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn;
update t1 set new_col=btn;
explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL btn NULL NULL NULL 14 where used
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref btn btn 11 const,const 10 where used
+1 SIMPLE t1 ref btn btn 11 const,const 10 where used
drop table t1;
CREATE TABLE t1 (
a int default NULL,
@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a a 5 const 10 where used
+1 SIMPLE t1 ref a a 5 const 10 where used
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
@@ -190,7 +190,7 @@ SELECT * FROM t1 WHERE b=NULL;
a b
explain SELECT * FROM t1 WHERE b IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref b b 5 const 1 where used
+1 SIMPLE t1 ref b b 5 const 1 where used
SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
index 5a8289a16f7..0e8a32bd7b7 100644
--- a/mysql-test/r/heap_btree.result
+++ b/mysql-test/r/heap_btree.result
@@ -66,7 +66,7 @@ a
alter table t1 type=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 FIRST t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
+1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
drop table t1;
create table t1 (x int not null, y int not null, key x using BTREE (x), unique y using BTREE (y))
type=heap;
@@ -85,8 +85,8 @@ x y x y
2 6 2 2
explain select * from t1,t1 as t2 where t1.x=t2.y;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL x NULL NULL NULL 6
-1 FIRST t2 eq_ref y y 4 t1.x 1
+1 SIMPLE t1 ALL x NULL NULL NULL 6
+1 SIMPLE t2 eq_ref y y 4 t1.x 1
drop table t1;
create table t1 (a int) type=heap;
insert into t1 values(1);
@@ -121,17 +121,17 @@ a b
1 6
explain select * from tx where a=x order by a,b;
id select_type table type possible_keys key key_len ref rows Extra
-x FIRST tx ref a a x const x where used
+x SIMPLE tx ref a a x const x where used
explain select * from tx where a=x order by b;
id select_type table type possible_keys key key_len ref rows Extra
-x FIRST tx ref a a x const x where used
+x SIMPLE tx ref a a x const x where used
select * from t1 where b=1;
a b
1 1
1 1
explain select * from tx where b=x;
id select_type table type possible_keys key key_len ref rows Extra
-x FIRST tx ref b b x const x where used
+x SIMPLE tx ref b b x const x where used
drop table t1;
create table t1 (id int unsigned not null, primary key using BTREE (id)) type=HEAP;
insert into t1 values(1);
@@ -172,17 +172,17 @@ create table t1 (btn char(10) not null, key using BTREE (btn)) type=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL btn NULL NULL NULL 14 where used
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn;
update t1 set new_col=btn;
explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref btn btn 10 const 1 where used
+1 SIMPLE t1 ref btn btn 10 const 1 where used
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref btn btn 11 const,const 1 where used
+1 SIMPLE t1 ref btn btn 11 const,const 1 where used
drop table t1;
CREATE TABLE t1 (
a int default NULL,
@@ -195,7 +195,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a a 5 const 1 where used
+1 SIMPLE t1 ref a a 5 const 1 where used
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
@@ -203,7 +203,7 @@ SELECT * FROM t1 WHERE b=NULL;
a b
explain SELECT * FROM t1 WHERE b IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref b b 5 const 1 where used
+1 SIMPLE t1 ref b b 5 const 1 where used
SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result
index 4dd79e5c52b..43a86069d3d 100644
--- a/mysql-test/r/heap_hash.result
+++ b/mysql-test/r/heap_hash.result
@@ -66,7 +66,7 @@ a
alter table t1 type=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 FIRST t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
+1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 where used; 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))
type=heap;
@@ -85,8 +85,8 @@ x y x y
2 6 2 2
explain select * from t1,t1 as t2 where t1.x=t2.y;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL x NULL NULL NULL 6
-1 FIRST t2 eq_ref y y 4 t1.x 1
+1 SIMPLE t1 ALL x NULL NULL NULL 6
+1 SIMPLE t2 eq_ref y y 4 t1.x 1
drop table t1;
create table t1 (a int) type=heap;
insert into t1 values(1);
@@ -159,17 +159,17 @@ create table t1 (btn char(10) not null, key using HASH (btn)) type=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL btn NULL NULL NULL 14 where used
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn;
update t1 set new_col=btn;
explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL btn NULL NULL NULL 14 where used
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref btn btn 11 const,const 10 where used
+1 SIMPLE t1 ref btn btn 11 const,const 10 where used
drop table t1;
CREATE TABLE t1 (
a int default NULL,
@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a a 5 const 10 where used
+1 SIMPLE t1 ref a a 5 const 10 where used
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
@@ -190,7 +190,7 @@ SELECT * FROM t1 WHERE b=NULL;
a b
explain SELECT * FROM t1 WHERE b IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref b b 5 const 1 where used
+1 SIMPLE t1 ref b b 5 const 1 where used
SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 7b709d6f471..de08465a2a0 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -140,13 +140,13 @@ id parent_id level
1015 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref level level 1 const 12 where used; Using index
+1 SIMPLE t1 ref level level 1 const 12 where used; Using index
explain select level,id from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref level level 1 const 12 where used; Using index
+1 SIMPLE t1 ref level level 1 const 12 where used; Using index
explain select level,id,parent_id from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref level level 1 const 12 where used
+1 SIMPLE t1 ref level level 1 const 12 where used
select level,id from t1 where level=1;
level id
1 1002
@@ -597,7 +597,7 @@ id parent_id level
1016 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref level level 1 const 6 where used; Using index
+1 SIMPLE t1 ref level level 1 const 6 where used; Using index
select level,id from t1 where level=1;
level id
1 1004
@@ -759,7 +759,7 @@ create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
explain select * from t1 where a > 0 and a < 50;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range PRIMARY PRIMARY 4 NULL 1 where used
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 where used
drop table t1;
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
@@ -893,28 +893,28 @@ create table t1 (a int not null, b int not null, c int not null, primary key (a)
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
explain select * from t1 order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL PRIMARY 4 NULL 4
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4
explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL b 4 NULL 4
+1 SIMPLE t1 index NULL b 4 NULL 4
explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4 Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select a from t1 order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL PRIMARY 4 NULL 4 Using index
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
explain select b from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL b 4 NULL 4 Using index
+1 SIMPLE t1 index NULL b 4 NULL 4 Using index
explain select a,b from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL b 4 NULL 4 Using index
+1 SIMPLE t1 index NULL b 4 NULL 4 Using index
explain select a,b from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL b 4 NULL 4 Using index
+1 SIMPLE t1 index NULL b 4 NULL 4 Using index
explain select a,b,c from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4
drop table t1;
create table t1 (t int not null default 1, key (t)) type=innodb;
desc t1;
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 3b9b13bdd3c..9c44792724b 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -91,11 +91,11 @@ grp a c id a c d
NULL NULL NULL NULL NULL NULL
explain select t1.*,t2.* from t1,t2 where t1.a=t2.a and isnull(t2.a)=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST Impossible WHERE noticed after reading const tables
+1 SIMPLE Impossible WHERE noticed after reading const tables
explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 7
-1 FIRST t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 where used
+1 SIMPLE t1 ALL NULL NULL NULL NULL 7
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 where used
select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
grp a c id a c d a
1 1 a 1 1 a 1 1
@@ -312,12 +312,12 @@ name name id
Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 3
-1 FIRST t2 ALL NULL NULL NULL NULL 3 where used; Not exists
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used; Not exists
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.name is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 3
-1 FIRST t2 ALL NULL NULL NULL NULL 3 where used
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used
select count(*) from t1 left join t2 on (t1.id = t2.owner);
count(*)
4
@@ -332,12 +332,12 @@ name name id
Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 3
-1 FIRST t2 ALL NULL NULL NULL NULL 3 where used; Not exists
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used; Not exists
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.name is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 3
-1 FIRST t2 ALL NULL NULL NULL NULL 3 where used
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used
select count(*) from t2 right join t1 on (t1.id = t2.owner);
count(*)
4
@@ -619,8 +619,8 @@ UNIQUE id (id,idx)
INSERT INTO t2 VALUES (1,1);
explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 2
-1 FIRST t2 index id id 8 NULL 1 where used; Using index; Not exists
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 index id id 8 NULL 1 where used; Using index; Not exists
SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
id name id idx
2 no NULL NULL
@@ -639,8 +639,8 @@ insert into t1 (fooID) values (10),(20),(30);
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 FIRST t2 index NULL PRIMARY 4 NULL 3 Using index
-1 FIRST t1 eq_ref PRIMARY PRIMARY 2 const 1 where used; Using index
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 2 const 1 where used; 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_diff.result b/mysql-test/r/key_diff.result
index 85d1f455b3f..bdeff4f60d8 100644
--- a/mysql-test/r/key_diff.result
+++ b/mysql-test/r/key_diff.result
@@ -35,8 +35,8 @@ D E a a
a a a a
explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL a NULL NULL NULL 5
-1 FIRST t2 ALL b NULL NULL NULL 5 where used
+1 SIMPLE t1 ALL a NULL NULL NULL 5
+1 SIMPLE t2 ALL b NULL NULL NULL 5 where used
select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
a b a b
A B a a
diff --git a/mysql-test/r/key_primary.result b/mysql-test/r/key_primary.result
index b3c9cef64f0..df9d962b3ac 100644
--- a/mysql-test/r/key_primary.result
+++ b/mysql-test/r/key_primary.result
@@ -12,8 +12,8 @@ t1
AB%
describe select * from t1 where t1="ABC";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 const PRIMARY PRIMARY 3 const 1
+1 SIMPLE t1 const PRIMARY PRIMARY 3 const 1
describe select * from t1 where t1="ABCD";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST Impossible WHERE noticed after reading const tables
+1 SIMPLE Impossible WHERE noticed after reading const tables
drop table t1;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index f8711d5f0f6..590169338a6 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -35,10 +35,10 @@ insert into t1 select NULL,message from t2;
create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2);
explain select * from t3 where a < 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t3 range a a 4 NULL 10 where used
+1 SIMPLE t3 range a a 4 NULL 10 where used
explain select * from t3 where a > 10 and a < 20;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t3 range a a 4 NULL 10 where used
+1 SIMPLE t3 range a a 4 NULL 10 where used
select * from t3 where a = 10;
a b
10 Testing
@@ -85,7 +85,7 @@ a b
19 Testing
explain select a from t3 order by a desc limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t3 index NULL a 4 NULL 1131 Using index
+1 SIMPLE t3 index NULL a 4 NULL 1131 Using index
select a from t3 order by a desc limit 10;
a
699
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 647fe70b694..4b4a88a54f7 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -52,26 +52,26 @@ create table t1 (a int not null, b int not null, c int not null, primary key (a)
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
explain select * from t1 order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4 Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4 Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4 Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select a from t1 order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL PRIMARY 4 NULL 4 Using index
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
explain select b from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL b 4 NULL 4 Using index
+1 SIMPLE t1 index NULL b 4 NULL 4 Using index
explain select a,b from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4 Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select a,b from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4
explain select a,b,c from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4
drop table t1;
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index a11f8ce6090..0a708ff298c 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/r/null_key.result
@@ -3,37 +3,37 @@ create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam;
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
explain select * from t1 where a is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a a 5 const 3 where used; Using index
+1 SIMPLE t1 ref a a 5 const 3 where used; Using index
explain select * from t1 where a is null and b = 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a,b a 9 const,const 1 where used; Using index
+1 SIMPLE t1 ref a,b a 9 const,const 1 where used; Using index
explain select * from t1 where a is null and b = 7;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a,b a 9 const,const 1 where used; Using index
+1 SIMPLE t1 ref a,b a 9 const,const 1 where used; Using index
explain select * from t1 where a=2 and b = 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 const a,b a 9 const,const 1
+1 SIMPLE t1 const a,b a 9 const,const 1
explain select * from t1 where a<=>b limit 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL a 9 NULL 12 where used; Using index
+1 SIMPLE t1 index NULL a 9 NULL 12 where used; Using index
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a,b a 9 NULL 3 where used; Using index
+1 SIMPLE t1 range a,b a 9 NULL 3 where used; Using index
explain select * from t1 where (a is null or a = 7) and b=7;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a,b b 4 const 2 where used
+1 SIMPLE t1 ref a,b b 4 const 2 where used
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a,b a 5 const 3 where used; Using index
+1 SIMPLE t1 ref a,b a 5 const 3 where used; 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 FIRST t1 range a,b a 9 NULL 2 where used; Using index
+1 SIMPLE t1 range a,b a 9 NULL 2 where used; 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 FIRST t1 range a a 5 NULL 1 where used; Using index
+1 SIMPLE t1 range a a 5 NULL 1 where used; 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 FIRST t1 range a a 5 NULL 1 where used; Using index
+1 SIMPLE t1 range a a 5 NULL 1 where used; Using index
select * from t1 where a is null;
a b
NULL 7
@@ -66,43 +66,43 @@ NULL 9
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
explain select * from t1 where a is null and b = 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a,b a 5 const 3 where used
+1 SIMPLE t1 ref a,b a 5 const 3 where used
explain select * from t1 where a is null and b = 2 and c=0;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a,b a 5 const 3 where used
+1 SIMPLE t1 ref a,b a 5 const 3 where used
explain select * from t1 where a is null and b = 7 and c=0;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a,b a 5 const 3 where used
+1 SIMPLE t1 ref a,b a 5 const 3 where used
explain select * from t1 where a=2 and b = 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a,b a 5 const 1 where used
+1 SIMPLE t1 ref a,b a 5 const 1 where used
explain select * from t1 where a<=>b limit 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 12 where used
+1 SIMPLE t1 ALL NULL NULL NULL NULL 12 where used
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a,b a 5 NULL 5 where used
+1 SIMPLE t1 range a,b a 5 NULL 5 where used
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a,b a 5 NULL 4 where used
+1 SIMPLE t1 range a,b a 5 NULL 4 where used
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a,b a 5 const 3 where used
+1 SIMPLE t1 ref a,b a 5 const 3 where used
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 FIRST t1 ref a,b a 5 const 3 where used
+1 SIMPLE t1 ref a,b a 5 const 3 where used
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 FIRST t1 range a a 5 NULL 1 where used
+1 SIMPLE t1 range a a 5 NULL 1 where used
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a,b a 5 NULL 4 where used
+1 SIMPLE t1 range a,b a 5 NULL 4 where used
explain select * from t1 where a > 8 and a < 9;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a a 5 NULL 1 where used
+1 SIMPLE t1 range a a 5 NULL 1 where used
explain select * from t1 where b like "6%";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range b b 12 NULL 1 where used
+1 SIMPLE t1 range b b 12 NULL 1 where used
select * from t1 where a is null;
a b c
NULL 7 0
@@ -152,10 +152,10 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
explain select id from t1 where uniq_id is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref idx1 idx1 5 const 1 where used
+1 SIMPLE t1 ref idx1 idx1 5 const 1 where used
explain select id from t1 where uniq_id =1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 const idx1 idx1 5 const 1
+1 SIMPLE t1 const idx1 idx1 5 const 1
UPDATE t1 SET id=id+100 where uniq_id is null;
UPDATE t2 SET id=id+100 where uniq_id is null;
select id from t1 where uniq_id is null;
diff --git a/mysql-test/r/odbc.result b/mysql-test/r/odbc.result
index eb6123075fe..f377d54e1a0 100644
--- a/mysql-test/r/odbc.result
+++ b/mysql-test/r/odbc.result
@@ -11,5 +11,5 @@ select * from t1 where a is null;
a b
explain select * from t1 where b is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST Impossible WHERE noticed after reading const tables
+1 SIMPLE Impossible WHERE noticed after reading const tables
drop table t1;
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 08d52a782e1..563aa178c87 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -264,13 +264,13 @@ 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 FIRST t1 range a a 20 NULL 2 where used; Using index
+1 SIMPLE t1 range a a 20 NULL 2 where used; 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
explain select * from t1 where a >= 1 and a < 3 order by a desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a a 4 NULL 10 where used; Using index
+1 SIMPLE t1 range a a 4 NULL 10 where used; Using index
select * from t1 where a >= 1 and a < 3 order by a desc;
a b c
2 3 c
@@ -286,7 +286,7 @@ a b c
1 NULL NULL
explain select * from t1 where a = 1 order by a desc, b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a a 4 const 5 where used; Using index
+1 SIMPLE t1 ref a a 4 const 5 where used; Using index
select * from t1 where a = 1 order by a desc, b desc;
a b c
1 3 b
@@ -297,34 +297,34 @@ a b c
1 NULL NULL
explain select * from t1 where a = 1 and b is null order by a desc, b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a a 9 const,const 2 where used; Using index; Using filesort
+1 SIMPLE t1 ref a a 9 const,const 2 where used; Using index; Using filesort
select * from t1 where a = 1 and b is null order by a desc, b desc;
a b c
1 NULL NULL
1 NULL b
explain select * from t1 where a >= 1 and a < 3 and b >0 order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a a 9 NULL 8 where used; Using index; Using filesort
+1 SIMPLE t1 range a a 9 NULL 8 where used; Using index; Using filesort
explain select * from t1 where a = 2 and b >0 order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a a 9 NULL 5 where used; Using index
+1 SIMPLE t1 range a a 9 NULL 5 where used; Using index
explain select * from t1 where a = 2 and b is null order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref a a 9 const,const 1 where used; Using index; Using filesort
+1 SIMPLE t1 ref a a 9 const,const 1 where used; Using index; Using filesort
explain select * from t1 where a = 2 and (b is null or b > 0) order by a
desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a a 9 NULL 6 where used; Using index
+1 SIMPLE t1 range a a 9 NULL 6 where used; Using index
explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a a 9 NULL 5 where used; Using index
+1 SIMPLE t1 range a a 9 NULL 5 where used; 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 FIRST t1 range a a 9 NULL 2 where used; Using index; Using filesort
+1 SIMPLE t1 range a a 9 NULL 2 where used; Using index; Using filesort
alter table t1 modify b int not null, modify c varchar(10) not null;
explain select * from t1 order by a, b, c;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL a 18 NULL 11 Using index
+1 SIMPLE t1 index NULL a 18 NULL 11 Using index
select * from t1 order by a, b, c;
a b c
1 0
@@ -340,7 +340,7 @@ a b c
2 3 c
explain select * from t1 order by a desc, b desc, c desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL a 18 NULL 11 Using index
+1 SIMPLE t1 index NULL a 18 NULL 11 Using index
select * from t1 order by a desc, b desc, c desc;
a b c
2 3 c
@@ -356,14 +356,14 @@ a b c
1 0
explain select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a a 18 NULL 3 where used; Using index
+1 SIMPLE t1 range a a 18 NULL 3 where used; Using index
select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
a b c
1 1 b
1 1 b
explain select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a a 4 NULL 6 where used; Using index
+1 SIMPLE t1 range a a 4 NULL 6 where used; Using index
select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
a b c
1 1 b
@@ -387,7 +387,7 @@ a b c
1 1
explain select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a a 8 NULL 10 where used; Using index
+1 SIMPLE t1 range a a 8 NULL 10 where used; Using index
select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
a b c
2 1 b
@@ -399,7 +399,7 @@ a b c
1 0
explain select * from t1 where a between 0 and 1 order by a desc, b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 range a a 4 NULL 5 where used; Using index
+1 SIMPLE t1 range a a 4 NULL 5 where used; Using index
select * from t1 where a between 0 and 1 order by a desc, b desc;
a b c
1 3 b
@@ -450,24 +450,24 @@ gid sid uid
103853 5 250
EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and t2.uid = t3.uid order by t1.gid, t3.uid;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index PRIMARY PRIMARY 4 NULL 6 Using index
-1 FIRST t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
-1 FIRST t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 where used; Using index
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index
+1 SIMPLE t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 where used; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index PRIMARY PRIMARY 4 NULL 6 Using index
-1 FIRST t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
-1 FIRST t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
-1 FIRST t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 where used; Using index
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
+1 SIMPLE t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 where used; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
-1 FIRST t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
-1 FIRST t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 where used
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 where used
drop table t1,t2,t3;
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 722a1f5c62c..b10738a9505 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -16,7 +16,7 @@ event_date type event_id
1999-07-14 100600 10
explain select event_date,type,event_id from t1 WHERE type = 100601 and event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST Impossible WHERE
+1 SIMPLE Impossible WHERE
select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND (type=100600 OR type=100100) or event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND type=100099;
event_date type event_id
1999-07-10 100100 24
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 8b3e2aa298e..8c7f3326912 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -1328,19 +1328,19 @@ select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
fld3
explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 ref fld3 fld3 30 const 1 where used; Using index
+1 SIMPLE t2 ref fld3 fld3 30 const 1 where used; Using index
explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 index NULL fld3 30 NULL 1199 where used; Using index
+1 SIMPLE t2 index NULL fld3 30 NULL 1199 where used; Using index
explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 index NULL fld3 30 NULL 1199 where used; Using index
+1 SIMPLE t2 index NULL fld3 30 NULL 1199 where used; Using index
explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 ref fld3 fld3 30 const 1 where used; Using index
+1 SIMPLE t2 ref fld3 fld3 30 const 1 where used; Using index
explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 ref fld3 fld3 30 const 1 where used; Using index
+1 SIMPLE t2 ref fld3 fld3 30 const 1 where used; Using index
explain select fld3 from t2 ignore index (fld3,not_used);
Key column 'not_used' doesn't exist in table
explain select fld3 from t2 use index (not_used);
@@ -1351,7 +1351,7 @@ honeysuckle
honoring
explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 range fld3 fld3 30 NULL 2 where used; Using index
+1 SIMPLE t2 range fld3 fld3 30 NULL 2 where used; Using index
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
fld1 fld3
148504 Colombo
@@ -1371,7 +1371,7 @@ fld1
250502
explain select fld1 from t2 where fld1=250501 or fld1="250502";
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 range fld1 fld1 4 NULL 2 where used; Using index
+1 SIMPLE t2 range fld1 fld1 4 NULL 2 where used; Using index
select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
fld1
250501
@@ -1380,7 +1380,7 @@ fld1
250601
explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 range fld1 fld1 4 NULL 4 where used; Using index
+1 SIMPLE t2 range fld1 fld1 4 NULL 4 where used; Using index
select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
fld1 fld3
218401 faithful
@@ -1807,8 +1807,8 @@ select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr orde
fld3
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
-1 FIRST t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
+1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
select period from t1;
period
9410
@@ -1822,8 +1822,8 @@ fld3 period
breaking 1001
explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 const fld1 fld1 4 const 1
-1 FIRST t3 const PRIMARY,period PRIMARY 4 const 1
+1 SIMPLE t2 const fld1 fld1 4 const 1
+1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
select fld3,period from t2,t1 where companynr*10 = 37*10;
fld3 period
breaking 9410
@@ -2562,20 +2562,20 @@ select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.
companynr companyname
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 ALL NULL NULL NULL NULL 1199
-1 FIRST t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 where used; Not exists
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 where used; Not exists
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t4 ALL NULL NULL NULL NULL 12
-1 FIRST t2 ALL NULL NULL NULL NULL 1199 where used; Not exists
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 where used; Not exists
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
37 36
41 40
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 ALL NULL NULL NULL NULL 1199 Using temporary
-1 FIRST t4 index NULL PRIMARY 1 NULL 12 where used; Using index
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using temporary
+1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 where used; Using index
select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
fld1 companynr fld3 period
038008 37 reporters 1008
@@ -3085,10 +3085,10 @@ fld1 sum(price)
038008 234298
explain select fld3 from t2 where 1>2 or 2>3;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST Impossible WHERE
+1 SIMPLE Impossible WHERE
explain select fld3 from t2 where fld1=fld1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502;
companynr fld1
34 250501
@@ -3140,7 +3140,7 @@ count(*)
4181
explain select min(fld1),max(fld1),count(*) from t2;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST Select tables optimized away
+1 SIMPLE Select tables optimized away
select min(fld1),max(fld1),count(*) from t2;
min(fld1) max(fld1) count(*)
0 1232609 1199
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 5a96cc08cbf..aa058a97109 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -49,7 +49,7 @@ a b
explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 ALL NULL NULL NULL NULL 2 where used
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 where used
3 UNION t4 ALL NULL NULL NULL NULL 3 where used; Using filesort
4 SUBSELECT t2 ALL NULL NULL NULL NULL 2
2 SUBSELECT t3 ALL NULL NULL NULL NULL 3 Using filesort
@@ -65,7 +65,7 @@ explain select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
(select * from t2 where a>1) as tt;
id select_type table type possible_keys key key_len ref rows Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 where used
-1 FIRST <derived3> system NULL NULL NULL NULL 1
+1 PRIMARY <derived3> system NULL NULL NULL NULL 1
2 SUBSELECT t3 ALL NULL NULL NULL NULL 3 where used; Using filesort
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
a
@@ -82,7 +82,7 @@ b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
9 7.5000
explain select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t4 ALL NULL NULL NULL NULL 3
+1 PRIMARY t4 ALL NULL NULL NULL NULL 3
2 DEPENDENT SUBSELECT t2 ALL NULL NULL NULL NULL 2
3 DEPENDENT SUBSELECT t3 ALL NULL NULL NULL NULL 3 where used
select * from t3 where exists (select * from t2 where t2.b=t3.a);
@@ -117,7 +117,7 @@ NULL 1
2 2
explain select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t2 ALL NULL NULL NULL NULL 2
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
2 DEPENDENT SUBSELECT t1 system NULL NULL NULL NULL 1 where used
3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 where used
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 51148cd12e9..22cfd2ceefa 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -76,5 +76,5 @@ date numfacture expedition
0000-00-00 00:00:00 1212 0001-00-00 00:00:00
EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref expedition expedition 8 const 1 where used
+1 SIMPLE t1 ref expedition expedition 8 const 1 where used
drop table t1;
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 86f62d11bdb..c64ee2ecd78 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -86,29 +86,29 @@ a b
1 a
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort
select found_rows();
FOUND_ROWS()
0
explain select a,b from t1 union all select a,b from t2;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 UNION t2 ALL NULL NULL NULL NULL 4
explain select xx from t1 union select 1;
Unknown column 'xx' in 'field list'
explain select a,b from t1 union select 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 4
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 UNION No tables used
explain select 1 union select a,b from t1 union select 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST No tables used
+1 PRIMARY No tables used
2 UNION t1 ALL NULL NULL NULL NULL 4
3 UNION No tables used
explain select a,b from t1 union select 1 limit 0;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST Impossible WHERE
+1 PRIMARY Impossible WHERE
2 UNION Impossible WHERE
select a,b from t1 into outfile 'skr' union select a,b from t2;
Wrong usage of UNION and INTO
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 10cb4fe5c8e..9b2c0316c18 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -19,14 +19,14 @@ i @vv1:=if(sv1.i,1,0) @vv2:=if(sv2.i,1,0) @vv3:=if(sv3.i,1,0) @vv1+@vv2+@vv3
2 1 0 0 1
explain select * from t1 where i=@vv1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref i i 4 const 1 where used
+1 SIMPLE t1 ref i i 4 const 1 where used
explain select * from t1 where @vv1:=@vv1+1 and i=@vv1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ALL NULL NULL NULL NULL 3 where used
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 where used
explain select @vv1:=i from t1 where i=@vv1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 index NULL i 4 NULL 3 where used; Using index
+1 SIMPLE t1 index NULL i 4 NULL 3 where used; Using index
explain select * from t1 where i=@vv1;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 ref i i 4 const 1 where used
+1 SIMPLE t1 ref i i 4 const 1 where used
drop table t1,t2;
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index a7bd29afd78..1b6cf5e708e 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -12,7 +12,7 @@ insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;
explain select * from t1 where UNIQ=0x38afba1d73e6a18a;
id select_type table type possible_keys key key_len ref rows Extra
-1 FIRST t1 const UNIQ UNIQ 8 const 1
+1 SIMPLE t1 const UNIQ UNIQ 8 const 1
drop table t1;
select x'hello';
You have an error in your SQL syntax near 'x'hello'' at line 1
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 8166a156b8c..a898df89383 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1443,7 +1443,9 @@ mysql_execute_command(void)
{
SELECT_LEX *first= sl->master_unit()->first_select();
res= mysql_explain_select(thd, sl,
- ((select_lex==sl)?"FIRST":
+ ((select_lex==sl)?
+ ((sl->next_select_in_list())?"PRIMARY":
+ "SIMPLE"):
((sl == first)?
((sl->depended)?"DEPENDENT SUBSELECT":
"SUBSELECT"):