create table BusinessCard
(id int not null, name varchar(255), address varchar(255), telephone varchar(255), createtime date)
partition by range(year(createtime))(
partition p0 values less than (2013),
partition p1 values less than (2014),
partition p2 values less than (2015),
partition p3 values less than MAXVALUE
);
show create table BusinessCard\G
insert into BusinessCard values (1, 'kim','seoul',' 123-456', '2000-01-01');
insert into BusinessCard values (2, 'lee','seoul',' 123-456', '2014-01-01');
explain partitions select * from BusinessCard where createtime >= '2014-01-01' \G
파티션 추가/삭제
alter table BusinessCard add partition(
partition p4 values less than (2005));
alter table BusinessCard drop partition p4;
파티션 분할/병합
alter table BusinessCard
reorganize partition p3 into (
partition p3 values less than(2015),
partition p4 values less than MAXVALUE
);
alter table BusinessCard
reorganize partition p2, p3 into (
partition p23 values less than (2014));
'mysql' 카테고리의 다른 글
샤딩 sharding (0) | 2018.12.19 |
---|---|
트랜잭션 Transcation, 락 Lock, 격리수준 IsolationLevel (0) | 2018.12.18 |
Azure Linux VM에서 MySQL 성능 최적화 (0) | 2016.06.16 |
보안 강도에 따른 해쉬함수 분류 ( sha2 512 in mysql, php ) (0) | 2013.10.28 |
group_concat 중복제거하기 (0) | 2013.10.11 |
댓글