|
|
@ -1,4 +1,32 @@ |
|
|
|
drop table if exists t1; |
|
|
|
create table t1 (a int, b char(10), c varchar(25), d datetime) |
|
|
|
partition by range column_list(a,b,c,d) |
|
|
|
subpartition by hash (to_seconds(d)) |
|
|
|
subpartitions 4 |
|
|
|
( partition p0 values less than (1, 0, MAXVALUE, 0), |
|
|
|
partition p1 values less than (1, 'a', MAXVALUE, TO_DAYS('1999-01-01')), |
|
|
|
partition p2 values less than (1, 'a', MAXVALUE, MAXVALUE), |
|
|
|
partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE)); |
|
|
|
select partition_method, partition_expression, partition_description |
|
|
|
from information_schema.partitions where table_name = "t1"; |
|
|
|
partition_method partition_expression partition_description |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'0',MAXVALUE,0 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'0',MAXVALUE,0 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'0',MAXVALUE,0 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'0',MAXVALUE,0 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|
|
|
drop table t1; |
|
|
|
create table t1 (a int, b int) |
|
|
|
partition by range column_list (a,b) |
|
|
|
(partition p0 values less than (NULL, maxvalue)); |
|
|
@ -8,12 +36,19 @@ partition by list column_list(a,b) |
|
|
|
( partition p0 values in ((maxvalue, 0))); |
|
|
|
Got one of the listed errors |
|
|
|
create table t1 (a int, b int) |
|
|
|
partition by list column_list (a,b) |
|
|
|
( partition p0 values in ((0,0))); |
|
|
|
alter table t1 add partition |
|
|
|
(partition p1 values in (maxvalue, maxvalue)); |
|
|
|
Got one of the listed errors |
|
|
|
drop table t1; |
|
|
|
create table t1 (a int, b int) |
|
|
|
partition by key (a,a); |
|
|
|
ERROR HY000: Duplicate partition field name a |
|
|
|
ERROR HY000: Duplicate partition field name 'a' |
|
|
|
create table t1 (a int, b int) |
|
|
|
partition by list column_list(a,a) |
|
|
|
( partition p values in ((1,1))); |
|
|
|
ERROR HY000: Duplicate partition field name a |
|
|
|
ERROR HY000: Duplicate partition field name 'a' |
|
|
|
create table t1 (a int signed) |
|
|
|
partition by list (a) |
|
|
|
( partition p0 values in (1, 3, 5, 7, 9, NULL), |
|
|
@ -61,6 +96,16 @@ partition_method partition_expression partition_description |
|
|
|
LIST COLUMN_LIST a,b (1,NULL),(2,NULL),(NULL,NULL) |
|
|
|
LIST COLUMN_LIST a,b (1,1),(2,2) |
|
|
|
LIST COLUMN_LIST a,b (3,NULL),(NULL,1) |
|
|
|
show create table t1; |
|
|
|
Table Create Table |
|
|
|
t1 CREATE TABLE `t1` ( |
|
|
|
`a` int(11) DEFAULT NULL, |
|
|
|
`b` int(11) DEFAULT NULL |
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|
|
|
/*!50100 PARTITION BY LIST COLUMN_LIST(a,b) |
|
|
|
(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM, |
|
|
|
PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM, |
|
|
|
PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) */ |
|
|
|
insert into t1 values (3, NULL); |
|
|
|
insert into t1 values (NULL, 1); |
|
|
|
insert into t1 values (NULL, NULL); |
|
|
@ -110,6 +155,14 @@ from information_schema.partitions where table_name = "t1"; |
|
|
|
partition_method partition_expression partition_description |
|
|
|
LIST a 2,1 |
|
|
|
LIST a NULL,4,3 |
|
|
|
show create table t1; |
|
|
|
Table Create Table |
|
|
|
t1 CREATE TABLE `t1` ( |
|
|
|
`a` int(11) DEFAULT NULL |
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|
|
|
/*!50100 PARTITION BY LIST (a) |
|
|
|
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, |
|
|
|
PARTITION p1 VALUES IN (NULL,4,3) ENGINE = MyISAM) */ |
|
|
|
insert into t1 values (1); |
|
|
|
insert into t1 values (2); |
|
|
|
insert into t1 values (3); |
|
|
@ -132,6 +185,14 @@ from information_schema.partitions where table_name = "t1"; |
|
|
|
partition_method partition_expression partition_description |
|
|
|
LIST COLUMN_LIST a 2,1 |
|
|
|
LIST COLUMN_LIST a 4,NULL,3 |
|
|
|
show create table t1; |
|
|
|
Table Create Table |
|
|
|
t1 CREATE TABLE `t1` ( |
|
|
|
`a` int(11) DEFAULT NULL |
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|
|
|
/*!50100 PARTITION BY LIST COLUMN_LIST(a) |
|
|
|
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, |
|
|
|
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */ |
|
|
|
insert into t1 values (1); |
|
|
|
insert into t1 values (2); |
|
|
|
insert into t1 values (3); |
|
|
@ -148,34 +209,6 @@ t1 CREATE TABLE `t1` ( |
|
|
|
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, |
|
|
|
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */ |
|
|
|
drop table t1; |
|
|
|
create table t1 (a int, b char(10), c varchar(25), d datetime) |
|
|
|
partition by range column_list(a,b,c,d) |
|
|
|
subpartition by hash (to_seconds(d)) |
|
|
|
subpartitions 4 |
|
|
|
( partition p0 values less than (1, 0, MAXVALUE, 0), |
|
|
|
partition p1 values less than (1, 'a', MAXVALUE, TO_DAYS('1999-01-01')), |
|
|
|
partition p2 values less than (1, 'a', MAXVALUE, MAXVALUE), |
|
|
|
partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE)); |
|
|
|
select partition_method, partition_expression, partition_description |
|
|
|
from information_schema.partitions where table_name = "t1"; |
|
|
|
partition_method partition_expression partition_description |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,0,MAXVALUE,0 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,0,MAXVALUE,0 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,0,MAXVALUE,0 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,0,MAXVALUE,0 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,730120 |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,'a',MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|
|
|
RANGE COLUMN_LIST a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE |
|
|
|
drop table t1; |
|
|
|
create table t1 (a int, b char(10), c varchar(5), d int) |
|
|
|
partition by range column_list(a,b,c) |
|
|
|
subpartition by key (c,d) |
|
|
@ -199,6 +232,21 @@ RANGE COLUMN_LIST a,b,c 3,'abc','abc' |
|
|
|
RANGE COLUMN_LIST a,b,c 4,'abc','abc' |
|
|
|
RANGE COLUMN_LIST a,b,c 4,'abc','abc' |
|
|
|
RANGE COLUMN_LIST a,b,c 4,'abc','abc' |
|
|
|
show create table t1; |
|
|
|
Table Create Table |
|
|
|
t1 CREATE TABLE `t1` ( |
|
|
|
`a` int(11) DEFAULT NULL, |
|
|
|
`b` char(10) DEFAULT NULL, |
|
|
|
`c` varchar(5) DEFAULT NULL, |
|
|
|
`d` int(11) DEFAULT NULL |
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|
|
|
/*!50100 PARTITION BY RANGE COLUMN_LIST(a,b,c) |
|
|
|
SUBPARTITION BY KEY (c,d) |
|
|
|
SUBPARTITIONS 3 |
|
|
|
(PARTITION p0 VALUES LESS THAN (1,'abc','abc') ENGINE = MyISAM, |
|
|
|
PARTITION p1 VALUES LESS THAN (2,'abc','abc') ENGINE = MyISAM, |
|
|
|
PARTITION p2 VALUES LESS THAN (3,'abc','abc') ENGINE = MyISAM, |
|
|
|
PARTITION p3 VALUES LESS THAN (4,'abc','abc') ENGINE = MyISAM) */ |
|
|
|
insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3); |
|
|
|
insert into t1 values (1,'b','c',1),(2,'b','c',2),(3,'b','c',3); |
|
|
|
insert into t1 values (1,'c','d',1),(2,'c','d',2),(3,'c','d',3); |
|
|
@ -218,6 +266,16 @@ from information_schema.partitions where table_name = "t1"; |
|
|
|
partition_method partition_expression partition_description |
|
|
|
RANGE COLUMN_LIST a,b,c 1,'A',1 |
|
|
|
RANGE COLUMN_LIST a,b,c 1,'B',1 |
|
|
|
show create table t1; |
|
|
|
Table Create Table |
|
|
|
t1 CREATE TABLE `t1` ( |
|
|
|
`a` int(11) DEFAULT NULL, |
|
|
|
`b` varchar(2) DEFAULT NULL, |
|
|
|
`c` int(11) DEFAULT NULL |
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|
|
|
/*!50100 PARTITION BY RANGE COLUMN_LIST(a,b,c) |
|
|
|
(PARTITION p0 VALUES LESS THAN (1,'A',1) ENGINE = MyISAM, |
|
|
|
PARTITION p1 VALUES LESS THAN (1,'B',1) ENGINE = MyISAM) */ |
|
|
|
insert into t1 values (1, 'A', 1); |
|
|
|
explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1; |
|
|
|
id select_type table partitions type possible_keys key key_len ref rows Extra |
|
|
@ -234,11 +292,21 @@ select * from t1 where a = 'a'; |
|
|
|
a b c |
|
|
|
a NULL NULL |
|
|
|
drop table t1; |
|
|
|
create table t1 (d timestamp) |
|
|
|
create table t1 (d time) |
|
|
|
partition by range column_list(d) |
|
|
|
( partition p0 values less than ('2000-01-01'), |
|
|
|
partition p1 values less than ('2040-01-01')); |
|
|
|
ERROR HY000: Partition column values of incorrect type |
|
|
|
create table t1 (d timestamp) |
|
|
|
partition by range column_list(d) |
|
|
|
( partition p0 values less than ('2000-01-01'), |
|
|
|
partition p1 values less than ('2040-01-01')); |
|
|
|
ERROR HY000: Field 'd' is of a not allowed type for this type of partitioning |
|
|
|
create table t1 (d bit(1)) |
|
|
|
partition by range column_list(d) |
|
|
|
( partition p0 values less than (0), |
|
|
|
partition p1 values less than (1)); |
|
|
|
ERROR HY000: Field 'd' is of a not allowed type for this type of partitioning |
|
|
|
create table t1 (a int, b int) |
|
|
|
partition by range column_list(a,b) |
|
|
|
(partition p0 values less than (maxvalue, 10)); |
|
|
|