#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
This commit is contained in:
Rich Prohaska 2010-10-22 17:35:27 +00:00
parent 09e849c671
commit c2540622ad
6 changed files with 3516 additions and 0 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,61 @@
# 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;

View file

@ -0,0 +1,63 @@
# 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;

View file

@ -0,0 +1,57 @@
# 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;