---
title: "How we built fast UPDATEs for the ClickHouse column store – Part 1: Purpose-built engines"
description: "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."
url: "https://swe.quest/articles/how-we-built-fast-updates-for-the-clickhouse-column-store-part-1-purpose-built-477e921f016259fa"
canonical: "https://clickhouse.com/blog/updates-in-clickhouse-1-purpose-built-engines"
source: "ClickHouse"
published: "2025-07-22"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 12
tags: ["analytics","storage-engines","databases"]
---

# How we built fast UPDATEs for the ClickHouse column store – Part 1: Purpose-built engines

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2025-07-22, 12 min read, Deep dive. Original: [https://clickhouse.com/blog/updates-in-clickhouse-1-purpose-built-engines](https://clickhouse.com/blog/updates-in-clickhouse-1-purpose-built-engines)

## Summary

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. Sorted, immutable data parts can be merged in a single linear pass, so keeping only the latest version adds almost no overhead. ReplacingMergeTree keeps the latest full row per sorting key, CoalescingMergeTree merges sparse partial updates using Nullable columns, and CollapsingMergeTree cancels rows with a sign column, which also lets it change sorting key values. All three give UPSERT semantics but are only eventually consistent, so queries that need current results use FINAL to apply the merge logic in memory at read time.

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)
- [Storage engines](https://swe.quest/tags/storage-engines.md) (Data & databases)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)

## Prerequisites

- column-oriented storage basics
- SQL DDL and inserts ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- LSM-style background merges ([easy posts on Storage engines](https://swe.quest/tags/storage-engines.md?difficulty=easy))

## Keywords

ClickHouse, MergeTree, ReplacingMergeTree, CoalescingMergeTree, CollapsingMergeTree, FINAL

## 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 25.6 summer bonus: CoalescingMergeTree table engine](https://swe.quest/articles/clickhouse-25-6-summer-bonus-coalescingmergetree-table-engine-dcf20257caf305cb.md): ClickHouse · 2025-07-14 · Medium · 8 min read · Analytics & OLAP, Storage engines, Databases, SQL
  CoalescingMergeTree, new in ClickHouse 25.6, consolidates sparse partial-row inserts during background merges by keeping, per sorting key and per column, the latest non-null value as determined by insertion order rather than a timestamp.
- [Handling Updates and Deletes in ClickHouse](https://swe.quest/articles/handling-updates-and-deletes-in-clickhouse-197a09a41f4d2486.md): ClickHouse · 2023-03-10 · Medium · 13 min read · Analytics & OLAP, Databases, Storage engines, SQL
  ClickHouse offers several ways to modify mostly-immutable analytical data, each with different costs.
- [ClickHouse Cloud boosts performance with SharedMergeTree and Lightweight Updates](https://swe.quest/articles/clickhouse-cloud-boosts-performance-with-sharedmergetree-and-lightweight-updates-60af5576ecb3ec04.md): ClickHouse · 2023-08-17 · Medium · 24 min read · Storage engines, Replication, Analytics & OLAP, Cloud platforms, Scaling
  SharedMergeTree is a new ClickHouse Cloud table engine that replaces ReplicatedMergeTree (and its zero-copy replication variant) by moving both data and part metadata off the servers into shared object storage and ClickHouse Keeper.
- [How we made ClickHouse UPDATEs 1,000× faster (Part 3: Benchmarks)](https://swe.quest/articles/how-we-made-clickhouse-updates-1-000-faster-part-3-benchmarks-0d540536665217da.md): ClickHouse · 2025-08-07 · Hard · 17 min read · Analytics & OLAP, Storage engines, Performance engineering, Databases
  ClickHouse's new standard SQL UPDATEs, implemented as lightweight patch parts, make changes visible up to ~1,000–1,700× faster than classic mutations on a 600M-row TPC-H lineitem table: one bulk update dropped from about 100 s to 60 ms. The benchmark compares classic mutations, on-the-fly mutations, lightweight updates and ReplacingMergeTree inserts for both bulk and single-row updates, measuring time to visibility and worst-case query slowdown before merges.

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)
