fbpx

partition a mysql table with number of rows

partition a mysql table with number of rows

Specify the table name where <TABLE_NAME> is given and specify the column name by which you want to do partition. 10, 20, 30, 40 are the numbers  by which the partition would be created.

ALTER TABLE <TABLE_NAME> PARTITION BY RANGE(id) (
PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20),
PARTITION p3 VALUES LESS THAN (30),
PARTITION p4 VALUES LESS THAN (40),
PARTITION p5 VALUES LESS THAN (MAXVALUE));

Share this post