O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

DROP partitions

If the data has crossed the retention, you can DROP the whole partition, which is superquick compared with conventional DELETE FROM TABLE statement. This is very helpful in archiving the data efficiently.

If p20170930 has crossed the retention, you can DROP the partition using the ALTER TABLE ... DROP PARTITION statement:

mysql> ALTER TABLE event_history DROP PARTITION p20170930;Query OK, 0 rows affected (0.02 sec)Records: 0  Duplicates: 0  Warnings: 0

Dropping the partition removes the PARTITION DEFINITION from the table.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required