mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
subqueries made printable
new EXPLAIN parameter to show real query as it was interpreted (SCRUM) (WL#1274)
This commit is contained in:
@ -86,10 +86,12 @@ a b
|
||||
1 a
|
||||
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
|
||||
ERROR 42000: Table 't1' from one of SELECT's can not be used in global ORDER clause
|
||||
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
|
||||
explain extended (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 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort
|
||||
Warnings:
|
||||
Note 1003 (select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 limit 2) union all (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 order by test.t2.a limit 1) order by b desc
|
||||
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
|
||||
a b
|
||||
1 a
|
||||
@ -463,10 +465,12 @@ create table t1 (a int not null primary key auto_increment, b int, key(b));
|
||||
create table t2 (a int not null primary key auto_increment, b int);
|
||||
insert into t1 (b) values (1),(2),(2),(3);
|
||||
insert into t2 (b) values (10),(11),(12),(13);
|
||||
explain (select * from t1 where a=1) union (select * from t2 where a=1);
|
||||
explain extended (select * from t1 where a=1) union (select * from t2 where a=1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
|
||||
2 UNION t2 const PRIMARY PRIMARY 4 const 1
|
||||
Warnings:
|
||||
Note 1003 (select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (test.t1.a = 1)) union (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a = 1))
|
||||
(select * from t1 where a=5) union (select * from t2 where a=1);
|
||||
a b
|
||||
1 10
|
||||
|
Reference in New Issue
Block a user