mysql数据库分区
1.按范围分区,例如年龄,时间
create table Boss(
Id int ,
FirstName varchar(128),
Age int
)
partition by range(Age)
(partition p1 values less than (18),
partition p2 values less than (60),
partition p3 values less than MAXVALUE)
查询的时候要注明那个分区
select * from Boss partition(p1) //把p1分区的都查出来,
若不带分区,则查出表中所有内容
select * from Boss
2.按列表分区,列表为固定值,如省份
create table Boss(
Id int ,
FirstName varchar(128),
Age int
)
partition by list(FirstName)
(partition p1 values in (18),
partition p2 values in (60),
partition p3 values in (80))