Partition management of MySQL partition

Source: Internet
Author: User

1.how the MySQL partition handles null values in a partitioned field1.range partition NULL is treated as a minimum value2.list partition null value must be enumerated or an error will occur3.hash/key partition null value treated as 02.RANGE&&LISTPartition Management1.Delete partition ALTER TABLE EMP drop partition p0;//Delete the P0 partition of the EMP, and note that the data for that partition will also be deleted2.add partition ALTER TABLE EMP ADD partition (partition P5 values less than (5000)); //cannot increase the partition that already exists partition name//range partition cannot add a partition that is smaller than the maximum value of the current maximum partition, for example, the current P4 partition maximum value is 6000, then P5 add 5000 will be error//list partition cannot add the partition that already has enum data in other partition , for example, P4 contains ' PHP ' This, then P5 can no longer contain ' php '.3. Redefine the partition (RangeALTER TABLE EMP REORGANIZE partition P5 into (partition P5 values less than (3000),partition P6 values less than (4000),partition P7 values less than (5000)        ); //originally P5 partition maximum value is 5000, now will p5 split into P5,P6,P7 each storage 1000//split partition can only be split into adjacent, cannot be p5,6,8 ... Splitting a partition cannot change the pattern of the original partition, for example, range cannot be broken into a list4. Redefine the partition (ListALTER TABLE EMP REORGANIZE partition P4, P5,P6 into {partition P4 values in (1,2,3,4,5,6,7,8,9,10)        ); //For example, the previous P4P5P6 contains 1234567810 of these 10 numbers, then all of them are now summed up in P4 to//list does not support the partition function of range, but can be partitioned and added to achieve the re-partitioning3.HASH &&KEYadd partition ALTER TABLE EMP COALESCE partition3; Delete 2 partitions for the EMP table//Note that data is deletedALTER TABLE EMP Add partition partitions 8;//8 + partitions added

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.