summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb/r/cluster_create_table.result
blob: bbc886fb329c559d0bd61b7e247d5b6bb0c368c5 (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
SET DEFAULT_STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS t1;
set tokudb_prelock_empty=off;
create table t1(a int, b int, c int, d int, primary key(a), key(b) clustering=yes)engine=tokudb;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `b` (`b`) `clustering`=yes
) ENGINE=TokuDB DEFAULT CHARSET=latin1
create index foo on t1(c,d) clustering=yes;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `b` (`b`) `clustering`=yes,
  KEY `foo` (`c`,`d`) `clustering`=yes
) ENGINE=TokuDB DEFAULT CHARSET=latin1
alter table t1 drop primary key;
alter table t1 add primary key (a,b,c,d);
alter table t1 add key bar(d,c,b,a) clustering=yes;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` int(11) NOT NULL,
  `c` int(11) NOT NULL,
  `d` int(11) NOT NULL,
  PRIMARY KEY (`a`,`b`,`c`,`d`),
  KEY `b` (`b`) `clustering`=yes,
  KEY `foo` (`c`,`d`) `clustering`=yes,
  KEY `bar` (`d`,`c`,`b`,`a`) `clustering`=yes
) ENGINE=TokuDB DEFAULT CHARSET=latin1
insert into t1 value
(1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4),(5,5,5,5),(6,6,6,6),
(32,54,12,56);
explain select * from t1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	index	NULL	PRIMARY	16	NULL	7	Using index
select * from t1;
a	b	c	d
1	1	1	1
2	2	2	2
3	3	3	3
4	4	4	4
5	5	5	5
6	6	6	6
32	54	12	56
explain select d from t1 where d > 30;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	bar	bar	4	NULL	1	Using where; Using index
select * from t1 where d > 30;
a	b	c	d
32	54	12	56
drop table t1;