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