1. Based on the given interval boundary, obtain several continuous interval ranges, and allocate the data to different partitions according to the placement point of the partition key.
Range partitioning is mainly used for partitioning date columns.
2. Range partitioning is implemented by using PARTITION BY RANGE(expr).
Where expr can be a certain column value, or an expression based on a certain column value and returns an integer value, such as YEAR (date).
Example
CREATE TABLE `Order` ( `id` INT NOT NULL AUTO_INCREMENT, `partition_key` INT NOT NULL, `amt` DECIMAL(5) NULL) PARTITION BY RANGE(partition_key) PARTITIONS 5( PARTITION part0 VALUES LESS THAN(201901), PARTITION part1 VALUES LESS THAN(201902), PARTITION part2 VALUES LESS THAN(201903), PARTITION part3 VALUES LESS THAN(201904), PARTITION part4 VALUES LESS THAN(201905), PARTITION part4 VALUES LESS THAN MAXVALUE; INSERT INTO `Order` (`id`, `partition_key`, `amt`) VALUES ('1', '201901', '1000'); INSERT INTO `Order` (`id`, `partition_key`, `amt`) VALUES ('2', '201902', '800'); INSERT INTO `Order` (`id`, `partition_key`, `amt`) VALUES ('3', '201903', '1200');
The above is the detailed content of What does mysql range partition refer to?. For more information, please follow other related articles on the PHP Chinese website!