---
title: "Handling Updates and Deletes in ClickHouse"
description: "ClickHouse offers several ways to modify mostly-immutable analytical data, each with different costs."
url: "https://swe.quest/articles/handling-updates-and-deletes-in-clickhouse-197a09a41f4d2486"
canonical: "https://clickhouse.com/blog/handling-updates-and-deletes-in-clickhouse"
source: "ClickHouse"
published: "2023-03-10"
difficulty: "medium"
kind: "How-to"
reading_minutes: 13
tags: ["analytics","databases","storage-engines","sql"]
---

# Handling Updates and Deletes in ClickHouse

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2023-03-10, 13 min read, How-to. Original: [https://clickhouse.com/blog/handling-updates-and-deletes-in-clickhouse](https://clickhouse.com/blog/handling-updates-and-deletes-in-clickhouse)

## Summary

ClickHouse offers several ways to modify mostly-immutable analytical data, each with different costs. Lightweight Deletes (DELETE FROM) write a \_row\_exists mask and rely on background merges to physically remove rows, which makes them cheap but leaves space reclamation non-deterministic. ALTER UPDATE/DELETE mutations rewrite whole parts, so they are heavy but guarantee removal, which matters for compliance. Cheaper alternatives cover specific cases: swapping in a new column with a DEFAULT for whole-table updates, Join engine plus joinGet for join-based updates, dropping partitions or using TTL for bulk and time-based deletion, and CollapsingMergeTree sign rows for frequent row-level updates.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)
- [Storage engines](https://swe.quest/tags/storage-engines.md) (Data & databases)
- [SQL](https://swe.quest/tags/sql.md) (Languages)

## Prerequisites

- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- ClickHouse MergeTree tables ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))

## Keywords

ClickHouse, Lightweight Deletes, MergeTree, CollapsingMergeTree, TTL, joinGet, mutations

## Related posts

- [How we built fast UPDATEs for the ClickHouse column store – Part 2: SQL-style UPDATEs](https://swe.quest/articles/how-we-built-fast-updates-for-the-clickhouse-column-store-part-2-sql-style-412c85fd8f57d493.md): ClickHouse · 2025-07-24 · Hard · 20 min read · Storage engines, Analytics & OLAP, Databases, SQL
  ClickHouse implemented standard SQL UPDATE in its MergeTree column store by evolving from classic mutations (which rewrite whole affected columns and hard-link unchanged ones) through lightweight DELETEs via a \_row\_exists mask column and on-the-fly in-memory updates, to patch parts.
- [ClickHouse Newsletter April 2023: Lightweight Deletes](https://swe.quest/articles/clickhouse-newsletter-april-2023-lightweight-deletes-81a82ae9ad782b41.md): ClickHouse · 2023-04-25 · Medium · 6 min read · Analytics & OLAP, Schema migrations, Data pipelines
  ClickHouse 23.3 makes lightweight deletes (DELETE FROM with a row condition) generally available and the preferred way to remove data, and also adds trace visualization to the Grafana plugin and parallel replicas that split a shard's data across replicas.
- [How we built fast UPDATEs for the ClickHouse column store – Part 1: Purpose-built engines](https://swe.quest/articles/how-we-built-fast-updates-for-the-clickhouse-column-store-part-1-purpose-built-477e921f016259fa.md): ClickHouse · 2025-07-22 · Medium · 12 min read · Analytics & OLAP, Storage engines, Databases
  ClickHouse avoids slow in-place row updates in its column store by expressing updates and deletes as inserts that get resolved during the background merges MergeTree already performs.
- [ClickHouse and dbt - A Gift from the Community](https://swe.quest/articles/clickhouse-and-dbt-a-gift-from-the-community-edc7ddee62ee1cfc.md): ClickHouse · 2023-02-01 · Medium · 7 min read · Analytics & OLAP, Data pipelines, Open source
  The dbt-clickhouse adapter, started by community contributor Dmitriy Sokolov and later taken over as a vendor-supported plugin, maps dbt's view, table, incremental and ephemeral materializations onto ClickHouse features.
- [ClickHouse Release 25.7](https://swe.quest/articles/clickhouse-release-25-7-3deecef07d4b1ccf.md): ClickHouse · 2025-08-08 · Medium · 13 min read · Analytics & OLAP, Query engines, Storage engines, Performance engineering
  ClickHouse 25.7 adds standard SQL UPDATE and DELETE built on lightweight "patch parts".

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
