v.24.8New Feature

Add SQL query to drop all detached partitions

Add a query ALTER TABLE ... DROP DETACHED PARTITION ALL to drop all detached partitions. #67885 (Duc Canh Le).
Introduces a new ALTER TABLE ... DROP DETACHED PARTITION ALL query to remove all detached partitions from a table.

Why it matters

Detached partitions accumulate when parts are manually detached or during certain maintenance operations, occupying disk space and potentially causing clutter. This feature provides a simple and efficient way to clean up all detached partitions in one operation, helping to reclaim disk space and maintain table hygiene.

How to use it

Use the following SQL syntax to drop all detached partitions from a table:

ALTER TABLE <table_name> DROP DETACHED PARTITION ALL

Replace <table_name> with the target table name. This command removes all partitions currently in the detached state.