summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb/t/card_pk_sk.test
blob: f1e11fbbc2aaf3eb430cffaaf90872742a5784af (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
source include/have_tokudb.inc;
set default_storage_engine='tokudb';

disable_warnings;
drop table if exists tt;
enable_warnings;

create table tt (a int, b int, primary key(a), key(b));
let $i=0;
while ($i < 1000) {
    let $a=4*$i;
    eval insert into tt values ($a,$a+1),($a+1,$a+2),($a+2,$a+3),($a+3,$a+4);
    inc $i;
}

# test that analyze computes the correct cardinality for the keys
show indexes from tt;
analyze table tt;
show indexes from tt;

# test that cardinality is persistent
flush tables;
show indexes from tt;

drop table tt;

create table tt (a int, b int, primary key(a), key(b));
let $i=0;
while ($i < 1000) {
    let $a=4*$i;
    eval insert into tt values ($a,0),($a+1,0),($a+2,0),($a+3,0);
    inc $i;
}

# test that analyze computes the correct cardinality for the keys
show indexes from tt;
analyze table tt;
show indexes from tt;

# test that cardinality is persistent
flush tables;
show indexes from tt;

drop table tt;