分区类型
?
1、range分区
?
create table employees (
? ? id int not null,
? ? fname varchar(30),
? ? lname varchar(30),
? ? hired date not null default '1970-01-01',
? ? separated date not null default '9999-12-31',
? ? job_code int not null,
? ? store_id int not null
)
partition by range (store_id) (
? ? partition p0 values less than (6),
? ? partition p1 values less than (11),
? ? partition p2 values less than (16),
? ? partition p3 values less than (21)
);
?
2、list分区
?
create table employees (
? ? id int not null,
? ? fname varchar(30),
? ? lname varchar(30),
? ? hired date not null default '1970-01-01',
? ? separated date not null default '9999-12-31',
? ? job_code int,
? ? store_id int
)
partition by list(store_id)
? ? partition pnorth values in (3,5,6,9,17),
? ? partition peast values in (1,2,10,11,19,20),
? ? partition pwest values in (4,12,13,14,18),
? ? partition pcentral values in (7,8,15,16)
);
?
3、hash分区
?
create table employees (
? ? id int not null,
? ? fname varchar(30),
? ? lname varchar(30),
? ? hired date not null default '1970-01-01',
? ? separated date not null default '9999-12-31',
? ? job_code int,
? ? store_id int
)
partition by hash(year(hired))
partitions 4;
?
4、key分区
?
5、子分区
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!