I have a range partitioned table, partitioned by day, where I want to drop data older than 30 days periodically.
My understanding is that ALTER TABLE .. DROP PARTITION will lock the whole table blocking DML in other partitions, whereas ALTER TABLE .. TRUNCATE PARTITION will not lock the table allowing DML in other partitions.
If I want to minimize the impact of pruning data, does it make sense to first truncate a partition before dropping it? If the partition is empty will the DROP PARTITION command hold the lock for less time or does the MySQL server optimise it so that even if the partition holds data the meta data lock is only acquired after dropping the rows?