ALTER TABLE [db.]table [ON CLUSTER cluster] DELETE [IN PARTITION partition_expr1 [, partition_expr2 ...]] WHERE filter_exprDeletes data matching the specified filtering expression. Implemented as a mutation.
The filter_expr must be of type UInt8. The query deletes rows in the table for which this expression takes a non-zero value.
One query can contain several commands separated by commas.
The IN PARTITION clause limits the mutation to the listed partitions. Without it, on tables of the ReplicatedMergeTree family, when the optimize_mutations_with_partition_pruning setting is enabled (the default), ClickHouse automatically detects partition key conditions in filter_expr and only mutates the affected partitions. On non-replicated MergeTree tables, use an explicit IN PARTITION clause to limit the mutation to specific partitions.
The synchronicity of the query processing is defined by the mutations_sync setting. By default, it is asynchronous.
See also