mariadb/mysql-test/suite/tokudb.cluster/t/2968-2.test
Rich Prohaska 2ba37f3f14 #3007 fix the 2968 mysql tests refs[t:3007]
git-svn-id: file:///svn/mysql/tests/mysql-test@25492 c7de825b-a66e-492c-adef-691d508d4ae1
2010-11-11 12:54:00 +00:00

69 lines
1.6 KiB
Text

# test that the query planner picks clustering keys for 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;
# join with no keys
show create table s;
show create table t;
explain select straight_join s.a,t.a from s,t where s.b = t.b;
# join with uncovered keys
alter table s add key(b);
alter table t add key(b);
show create table s;
show create table t;
explain select straight_join s.a,t.a from s,t where s.b = t.b;
# join with uncovered keys and covering keys
# should pick the covering keys
alter table s add key(b,a);
alter table t add key(b,a);
show create table s;
show create table t;
explain select straight_join s.a,t.a from s,t where s.b = t.b;
# join with uncovered keys, covering keys and clustering keys
# should pick the covering keys
alter table s add clustering key(b);
alter table t add clustering key(b);
show create table s;
show create table t;
explain select straight_join s.a,t.a from s,t where s.b = t.b;
# join with uncovered keys and clustering keys
# should pick the clustering keys
alter table s drop key b_2;
alter table t drop key b_2;
show create table s;
show create table t;
explain select straight_join s.a,t.a from s,t where s.b = t.b;
# cleanup
drop table s,t;