summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb/t/card_drop_index_2.test
blob: 9e8b412760c3aedd8b4e0afd5aaa8db2a19fe479 (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
# test that add index keeps cardinality for older indexes

source include/have_tokudb.inc;
set default_storage_engine='tokudb';

disable_warnings;
drop table if exists tt;
enable_warnings;

set @save_use_stat_tables =  @@use_stat_tables;
set @@use_stat_tables = COMPLEMENTARY;

create table tt (a int, b int, c int, primary key(a), key(b), key(c));
let $a=0;
while ($a < 500) {
    eval insert into tt values ($a, $a, 0), ($a+1, $a, 0), ($a+2, $a, 0), ($a+3, $a, 0);
    inc $a; inc $a; inc $a; inc $a;
}
select count(*) from tt;

# compute cardinality
show indexes from tt;
analyze table tt;
show indexes from tt;

# drop key b
alter table tt drop key b;
show indexes from tt;

# drop key c
alter table tt drop key c;
show indexes from tt;

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

set @@use_stat_tables =  @save_use_stat_tables;
drop table tt;