> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Documentation for Apply mask of deleted rows

# Apply mask of deleted rows

```sql theme={null}
ALTER TABLE [db].name [ON CLUSTER cluster] APPLY DELETED MASK [IN PARTITION partition_id]
```

The command applies mask created by [lightweight delete](/snippets/delete) and forcefully removes rows marked as deleted from disk. This command is a heavyweight mutation, and it semantically equals to query `ALTER TABLE [db].name DELETE WHERE _row_exists = 0`.

<Note>
  It only works for tables in the [`MergeTree`](/reference/engines/table-engines/mergetree-family/mergetree) family (including [replicated](/reference/engines/table-engines/mergetree-family/replication) tables).
</Note>

**See also**

* [Lightweight deletes](/snippets/delete)
* [Heavyweight deletes](/reference/statements/alter/delete)
