mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge branch '10.3' into 10.4
This commit is contained in:
@ -239,4 +239,48 @@ drop table t1,t2,t3;
|
||||
set optimizer_switch='split_materialized=default';
|
||||
set use_stat_tables=default;
|
||||
set optimizer_use_condition_selectivity=default;
|
||||
#
|
||||
# MDEV-26337: subquery with groupby and ROLLUP returns incorrect results
|
||||
# (The testcase is taken from testcase for MDEV-13389 due to it being
|
||||
# much smaller)
|
||||
#
|
||||
create table t3 (a int, b int, c char(127), index idx_b(b)) engine=myisam;
|
||||
insert into t3 values
|
||||
(8,11,'aa'), (5,15,'cc'), (1,14,'bb'), (2,12,'aa'), (7,17,'cc'),
|
||||
(7,18,'aa'), (2,11,'aa'), (7,10,'bb'), (3,11,'dd'), (4,12,'ee'),
|
||||
(5,14,'dd'), (9,12,'ee');
|
||||
create table t4 (a int, b int, c char(127), index idx(a,c)) engine=myisam;
|
||||
insert into t4 values
|
||||
(7,10,'cc'), (1,20,'aa'), (2,23,'bb'), (7,18,'cc'), (1,30,'bb'),
|
||||
(4,71,'xx'), (3,15,'aa'), (7,82,'aa'), (8,12,'dd'), (4,15,'aa'),
|
||||
(11,33,'yy'), (10,42,'zz'), (4,53,'xx'), (10,17,'yy'), (7,12,'cc'),
|
||||
(8,20,'dd'), (7,32,'bb'), (1,50,'aa'), (3,40,'bb'), (3,77,'aa');
|
||||
insert into t4 select a+10, b+10, concat(c,'f') from t4;
|
||||
analyze table t3,t4;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t3 analyze status Engine-independent statistics collected
|
||||
test.t3 analyze status OK
|
||||
test.t4 analyze status Engine-independent statistics collected
|
||||
test.t4 analyze status OK
|
||||
# This should use a plan with LATERAL DERIVED:
|
||||
explain select t3.a,t3.c,t.max,t.min
|
||||
from t3 join
|
||||
(select a, c, max(b) max, min(b) min from t4 group by a,c) t
|
||||
on t3.a=t.a and t3.c=t.c
|
||||
where t3.b > 15;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t3 range idx_b idx_b 5 NULL 2 Using index condition; Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 2
|
||||
2 LATERAL DERIVED t4 ref idx idx 133 test.t3.a,test.t3.c 1
|
||||
# ... and if one adds WITH ROLLUP, then LATERAL DERIVED is no longer used:
|
||||
explain select t3.a,t3.c,t.max,t.min
|
||||
from t3 join
|
||||
(select a, c, max(b) max, min(b) min from t4 group by a,c with rollup) t
|
||||
on t3.a=t.a and t3.c=t.c
|
||||
where t3.b > 15;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t3 range idx_b idx_b 5 NULL 2 Using index condition; Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 4
|
||||
2 DERIVED t4 ALL NULL NULL NULL NULL 40 Using filesort
|
||||
drop table t3, t4;
|
||||
# End of 10.3 tests
|
||||
|
Reference in New Issue
Block a user