mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 22:34:18 +01:00
8825163905
git-svn-id: file:///svn/mysql/tests/mysql-test@48583 c7de825b-a66e-492c-adef-691d508d4ae1
59 lines
1.8 KiB
Text
59 lines
1.8 KiB
Text
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), clustering key(b))engine=tokudb;
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL DEFAULT '0',
|
|
`b` int(11) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
`d` int(11) DEFAULT NULL,
|
|
PRIMARY KEY (`a`),
|
|
CLUSTERING KEY `b` (`b`)
|
|
) ENGINE=TokuDB DEFAULT CHARSET=latin1
|
|
create clustering index foo on t1(c,d);
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL DEFAULT '0',
|
|
`b` int(11) DEFAULT NULL,
|
|
`c` int(11) DEFAULT NULL,
|
|
`d` int(11) DEFAULT NULL,
|
|
PRIMARY KEY (`a`),
|
|
CLUSTERING KEY `b` (`b`),
|
|
CLUSTERING KEY `foo` (`c`,`d`)
|
|
) 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 clustering key bar(d,c,b,a);
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL DEFAULT '0',
|
|
`b` int(11) NOT NULL DEFAULT '0',
|
|
`c` int(11) NOT NULL DEFAULT '0',
|
|
`d` int(11) NOT NULL DEFAULT '0',
|
|
PRIMARY KEY (`a`,`b`,`c`,`d`),
|
|
CLUSTERING KEY `b` (`b`),
|
|
CLUSTERING KEY `foo` (`c`,`d`),
|
|
CLUSTERING KEY `bar` (`d`,`c`,`b`,`a`)
|
|
) 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),(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 5 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
|
|
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;
|