Unlike Oracle, MySQL does not have a global index and only has a partition index. Therefore, MySQL has more restrictions than Oracle:
1. The partition key must be part of the primary key.
2. The data type of the partition key must be INTEGER (including the time type)
3. The partition key cannot be NULL.
The following is a time-based table partition definition:
PARTITION BY RANGE (TO_DAYS(START))( PARTITION p201401 VALUES LESS THAN (TO_DAYS('20140201')), PARTITION p201402 VALUES LESS THAN (TO_DAYS('20140301')), PARTITION p201403 VALUES LESS THAN (TO_DAYS('20140401')), PARTITION p201404 VALUES LESS THAN (TO_DAYS('20140501')), PARTITION p201405 VALUES LESS THAN (TO_DAYS('20140601')), PARTITION p201406 VALUES LESS THAN (TO_DAYS('20140701')), PARTITION p201407 VALUES LESS THAN (TO_DAYS('20140801')), PARTITION p201408 VALUES LESS THAN (TO_DAYS('20140901')), PARTITION p201409 VALUES LESS THAN (TO_DAYS('20141001')), PARTITION p201410 VALUES LESS THAN (TO_DAYS('20141101')), PARTITION p201411 VALUES LESS THAN (TO_DAYS('20141201')), PARTITION p201412 VALUES LESS THAN (TO_DAYS('20150101')), PARTITION pmax VALUES LESS THAN maxvalue);
The partition management of MySQL is not as powerful as that of Oracle, and partition exchange is supported from 5.6.