[MySQL] Partition Table

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.