summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb/t/card_add_index.test
blob: 54f29fcf2899488682f6e676ed290f8954d4cfd2 (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
# 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));
insert into tt values (1,0,0),(2,0,0),(3,0,1),(4,0,1);

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

# add a key(b)
alter table tt add key (b);
show indexes from tt;
analyze table tt;
show indexes from tt;

# add a key(c)
alter table tt add key (c);
show indexes from tt;
analyze table tt;
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;