mirror of
https://github.com/MariaDB/server.git
synced 2025-01-24 07:44:22 +01:00
b08d67c90b
git-svn-id: file:///svn/mysql/tests/mysql-test@55040 c7de825b-a66e-492c-adef-691d508d4ae1
65 lines
1.4 KiB
Text
65 lines
1.4 KiB
Text
# test that the query planner picks clustering keys for 3 table joins
|
|
|
|
# create table s
|
|
--disable_warnings
|
|
drop table if exists s;
|
|
--enable_warnings
|
|
create table s (a int, b int, c int) engine=tokudb;
|
|
|
|
# populate table s
|
|
let $a = 10;
|
|
while ($a) {
|
|
let $b = 10;
|
|
while ($b) {
|
|
let $c = 10;
|
|
while ($c) {
|
|
eval insert into s values ($a,$b,$c);
|
|
dec $c;
|
|
}
|
|
dec $b;
|
|
}
|
|
dec $a;
|
|
}
|
|
|
|
# create table t
|
|
--disable_warnings
|
|
drop table if exists t;
|
|
--enable_warnings
|
|
create table t like s;
|
|
insert into t select * from s;
|
|
|
|
# create table u;
|
|
--disable_warnings
|
|
drop table if exists u;
|
|
--enable_warnings
|
|
create table u like s;
|
|
insert into u select * from s;
|
|
|
|
# join with no keys
|
|
show create table s;
|
|
show create table t;
|
|
show create table u;
|
|
explain select straight_join * from s,t,u where s.b = t.b and s.c = t.c;
|
|
|
|
# join with uncovered keys
|
|
alter table s add key (b);
|
|
alter table t add key (b);
|
|
alter table u add key (c);
|
|
show create table s;
|
|
show create table t;
|
|
show create table u;
|
|
explain select straight_join * from s,t,u where s.b = t.b and s.c = u.c;
|
|
|
|
# join with clustering keys
|
|
alter table s add clustering key (b);
|
|
alter table t add clustering key (b);
|
|
alter table u add clustering key (c);
|
|
show create table s;
|
|
show create table t;
|
|
show create table u;
|
|
explain select straight_join * from s,t,u where s.b = t.b and s.c = u.c;
|
|
|
|
# cleanup
|
|
drop table s,t,u;
|
|
|
|
|