建立分割槽表
create table user(id int(11) not null,name varchar(32) not null)
partition by range(id)
(
partition p0 values less than(10),
partition p1 values less than(20),
partition p2 values less than(30),
partition p3 values less than maxvalue
)
分割槽表資料儲存
資料儲存檔案將根據分割槽被拆分成多份
分割槽資料查詢
構造資料
insert into user values(1,'Kobe Bryant');
insert into user values(12,'Allen Iverson');
insert into user values(22,'Tracy McGrady');
insert into user values(50,'Vince Carter');
普通表與分割槽表的互轉
ALTER TABLE students PARTITION BY KEY(sid) PARTITIONS 2;
移除分割槽資訊
ALTER TABLE user remove partitioning;