MySQL multi-column partitioning

Source: Internet
Author: User

MySQL multi-column partitioning a table created for an instance of MySQL5.5 COLUMNS partition: Java code drop TABLE if exists partition_test; CREATE table 'partition _ test' ('t _ id' int (11) not null AUTO_INCREMENT, 'test _ date' datetime not null, 't_key' varchar (16), 'test _ info' varchar (50) DEFAULT 'test ', primary key ('t_id', 'test _ date', 't_ key') ENGINE = InnoDB default charset = utf8 partition by range columns (test_date, t_key) (PARTITION p201303151 values less than ('2017-03-15 ', 'm2'), PARTITION p201303152 values less than ('2017-03-15 ', 'm3 '), PARTITION p201301_1 values less than ('1970-03-16 ', 'm2'), PARTITION p201301_2 values less than ('1970-03-16 ', 'm3 '), PARTITION p201303171 values less than ('2017-03-17 ', 'm2'), PARTITION p201303172 values less than ('2017-03-17 ', 'm3'); pay attention to two points: 1. 5.5 After COLUMNS partition is added, the time conversion function is no longer required; 2. The partition field must add a table PARTITION for the primary key. Java code alter table 'partition _ test' add PARTITION (partition p201303181 values less than ('2017-03-18 ', 'm2 ')); delete A table partition (deleting a PARTITION will delete the data in the partition) Java code alter table 'partition _ test' drop partition p201303181;

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.