mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.3 into 10.4
This commit is contained in:
@@ -1195,3 +1195,57 @@ drop table t1,t2,t3;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-9959: A serious MariaDB server performance bug
|
||||
#
|
||||
create table t1(a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6);
|
||||
create table t2(a int, b int,c int);
|
||||
insert into t2(a,b,c) values (1,1,2),(2,2,3),(3,1,4),(4,2,2),(5,1,1),(6,2,5);
|
||||
create table t3(a int, b int);
|
||||
insert into t3(a,b) values (1,1),(2,2),(2,1),(1,2),(5,1),(9,2);
|
||||
table "<derived2>" should have type=ref and rows=1
|
||||
one select in derived table
|
||||
with distinct
|
||||
analyze select * from t1 , ((select distinct t2.a from t2 order by c))q where t1.a=q.a;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 1.00 100.00 100.00
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using temporary; Using filesort
|
||||
analyze select * from t1 , ((select distinct t2.a, t2.b from t2 order by c))q where t1.a=q.a;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 1.00 100.00 100.00
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using temporary; Using filesort
|
||||
# multiple selects in derived table
|
||||
# NO UNION ALL
|
||||
analyze select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 1.00 100.00 100.00
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
|
||||
3 UNION t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 6.00 NULL NULL
|
||||
select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a;
|
||||
a a
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
# UNION ALL and EXCEPT
|
||||
analyze select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 0.50 100.00 100.00
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
|
||||
3 UNION t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
|
||||
4 EXCEPT t3 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
|
||||
NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL 3.00 NULL NULL
|
||||
select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;
|
||||
a a
|
||||
3 3
|
||||
4 4
|
||||
6 6
|
||||
drop table t1,t2,t3;
|
||||
|
Reference in New Issue
Block a user