Commit c2540622 authored by Rich Prohaska's avatar Rich Prohaska

#2968 test cases for mysql joins with clustering keys refs[t:2968]

git-svn-id: file:///svn/mysql/tests/mysql-test@24775 c7de825b-a66e-492c-adef-691d508d4ae1
parent 09e849c6
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# test that the query planner picks clustering keys for joins
# create table s
drop table if exists s;
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
drop table if exists t;
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 * 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 * from s,t where s.b = t.b;
# join with uncovered keys and clustering 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 * from s,t where s.b = t.b;
# join with clustering keys
alter table s drop key b;
alter table t drop key b;
show create table s;
show create table t;
explain select straight_join * from s,t where s.b = t.b;
# put the uncovered keys back
alter table s add key(b);
alter table t add key(b);
show create table s;
show create table t;
explain select straight_join * from s,t where s.b = t.b;
# test that the query planner picks clustering keys for joins
# create table s
drop table if exists s;
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
drop table if exists t;
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;
# test that the query planner picks clustering keys for 3 table joins
# create table s
drop table if exists s;
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
drop table if exists t;
create table t like s;
insert into t select * from s;
# create table u;
drop table if exists u;
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;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment