Partitioned Table Management Operations

Source: Internet
Author: User

1. Adding partitions

RANG add partition alter TABLE m_tbstatus_rang2 DROP PARTITION Pdbmax; ALTER TABLE m_tbstatus_rang2 ADD PARTITION (PARTITION PDB4 VALUES less THAN (4)); ALTER TABLE m_tbstatus_rang2 ADD PARTITION (PARTITION pdbmax VALUES less THAN MAXVALUE ENGINE = INNODB); List partition table ALTER TABLE M_tbstatus_list ADD PARTITION (PARTITION PDB20 VALUES in () ENGINE = INNODB); Hash\key (add 8 partitions) ALTER TABLE m_tbstatus_rang4 add PARTITION partitions 8;



2. Delete a partition

Rang\list directly delete the partition name alter TABLE m_tbstatus_list DROP PARTITION PDB20; Hash\key (directly modified to 3 partitions) ALTER TABLE M_tbstatus_rang4 PARTITION by KEY (dbid) partitions 3;



3. Merging partitions

Merge the original pdb17,pdb18 partitions and place them in the new PDB17 partition.

ALTER TABLE m_tbstatus_list REORGANIZE PARTITION pdb19,pdb18 into (PARTITION PDB18 VALUES in (18,19));



4. Clear the partition

ALTER TABLE m_tbstatus_list TRUNCATE PARTITION PDB18


5. Rebuilding partitions

ALTER TABLE m_tbstatus_list REBUILD PARTITION PDB18


5. View partitions

SHOW CREATE TABLE m_tbstatus_list;


This article is from the "Dead Leaf" blog, please make sure to keep this source http://mydbs.blog.51cto.com/513727/1745290

Partitioned Table Management Operations

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.