alter table account_rel_dept PARTITION BY RANGE (account_id) (
partition i1 VALUES LESS THAN (500000),
partition i2 VALUES LESS THAN (1000000),
partition i3 VALUES LESS THAN (1500000),
partition i4 VALUES LESS THAN (2000000),
partition i5 VALUES LESS THAN (2500000),
partition i6 VALUES LESS THAN (3000000),
partition i7 VALUES LESS THAN (3500000),
partition i8 VALUES LESS THAN (4000000),
partition i20 VALUES LESS THAN MAXVALUE
);
注:account_rel_dept为表名,account_id 是表的自增主键。
分区对千万级数据没有什么做用。千万级数据性能优化还是要通过建索引、和改进SQL文写法来实现。