MySQL PARTITION MANAGEMENT
MySQL PARTITION MANAGEMENT is a SQL statement in the MySQL Specific category. MySQL: manage partitions by adding, dropping, merging, splitting, or rebuilding them. The syntax is ALTER TABLE t REORGANIZE PARTITION p INTO (PARTITION p1, PARTITION p2);. It returns partition managed. A typical example: -- Add partition: ALTER TABLE sales ADD PARTITION ( PARTITION p2027 VALUES LESS THAN (2028) ); -- Drop partition (fastest way to delete old data): ALTER TABLE sales DROP PARTITION p2024; -- Drops partition and its data instantly (no DELETE overhead) -- Split partition: ALTER TABLE sales REORGANIZE PARTITION p2025 INTO ( PARTITION p2025_h1 VALUES LESS THAN (2025-07-01), PARTITION p2025_h2 VALUES LESS THAN (2026-01-01) ); -- Truncate partition: ALTER TABLE… A close relative is AUTO_INCREMENT, which mySQL auto-generates sequential integer values for this column. Commonly used with PRIMARY KEY. A close relative is ENGINE, which specifies the MySQL storage engine. InnoDB (default) supports transactions and foreign keys. MyISAM is faster for read-heavy.