summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb/t/cluster_2968-1.test
blob: 7ed2fc2cd7d82d380f2188bbf67735270006fc24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
source include/have_tokudb.inc;
# 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 * 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 key(b) clustering=yes;
alter table t add key(b) clustering=yes;
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;

# cleanup
drop table s,t;