ClickHouse Cloud: Fast, Updatable Lookups with the Join Table Engine
ClickHouse's Join table engine keeps a precomputed in-memory hash map for a fixed join strictness, type and key. With ANY LEFT strictness, inserts behave as upserts, which suits Type 1 slowly changing dimensions as an updatable alternative to Dictionaries, queried via Direct Join or joinGet. In open source the engine isn't distributed and persists each insert as an uncompacted .bin file, which degrades over time. ClickHouse Cloud transparently backs Join tables with a SharedJoin over a MergeTree (ALL) or ReplacingMergeTree (ANY) table, refreshing memory with a FINAL query on insert and startup, so deduplication, compaction and clustering are handled automatically.
Related posts
- ClickHouse Joins Under the Hood - Direct Join
ClickHouse mediumAdept
ClickHouse's direct join is its fastest join algorithm. It applies when the right-hand table sits on storage that supports low-latency key-value lookups: the Join engine, EmbeddedRocksDB or a Dictionary. The left table is streamed in parallel and each row is joined by looking it up directly in the in-memory structure, so there is no hash-table build phase (a FilledJoin step instead of FillRightFirst). Only LEFT ANY JOIN is supported, because dictionaries deduplicate on the key. A flat dictionary layout gives O(1) array-offset lookups at higher memory cost, and is 2-5x faster than a hashed layout. The worked examples use dictGet, EXPLAIN PLAN and timing comparisons against hash and parallel hash joins on a 100M-row table.
- ClickHouse Release 24.12
ClickHouse mediumAdept
ClickHouse 24.12 adds LIKE and unknown-value equality/IN support for Enums, an experimental descending MergeTree sorting key, JSON subcolumns as primary key columns, Iceberg REST catalog (Unity, Polaris) and schema evolution support, and automatic JOIN side swapping via query_plan_join_swap_table. On 100M Bluesky events, ordering by JSON subcolumns made a filtered query about 50x faster with 150x less memory. The now-default parallel hash join ran TPC-H Q3 at scale factor 100 about 8x faster than the plain hash join. The auto swap mode picks the smaller table as the hash-table build side to save memory and time.
- Join me if you can: ClickHouse vs. Databricks vs. Snowflake - Part 2
ClickHouse mediumAdept
Replacing fact-to-dimension joins with in-memory dictionaries in ClickHouse Cloud sped up a 17-query join benchmark over 1.4 billion rows by 1.9–3.5× in total runtime, up to 6.6× on individual queries, and cut cost by up to 60%. The Locations table becomes a complex_key_hashed dictionary for String-key lookups. The Products table becomes a range_hashed dictionary that resolves time-versioned rows with a hash map plus binary search over date ranges, provided the source has no overlapping ranges per key. Queries change only by swapping JOINs for dictGet calls, and the gains grew as the cluster scaled from 2 to 8 nodes.
- ClickHouse Cloud boosts performance with SharedMergeTree and Lightweight Updates
ClickHouse mediumAdept
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. Servers become stateless compute nodes: they cache subsets of metadata locally and learn about new parts through Keeper subscriptions rather than a replication log and exclusive locks. New nodes can join almost instantly, and inserts are durable once the part is in object storage and its metadata is in Keeper. This removes the replication-log contention and local-disk dependencies that limited scaling beyond a few replicas. Lightweight updates are introduced alongside and benefit from the shared-metadata design.
- ClickHouse Release 25.7
ClickHouse mediumAdept
ClickHouse 25.7 adds standard SQL UPDATE and DELETE built on lightweight "patch parts". Instead of rewriting columns, small immutable parts are applied during background merges and matched at query time, making declarative updates up to 1,000× faster in ClickHouse's benchmarks. count() GROUP BY aggregations now store the 64-bit count directly in the hash table cell, skipping the memory arena and pointer indirection, which cut query time ~34% and memory ~21% on a 100M-row benchmark. The release also brings four hash-join optimizations: tighter single-key loops, faster OR-condition joins, no repeated hashing, and precisely sized result buffers, worth roughly 1.4–1.8× speedups, plus AI-powered SQL generation in clickhouse-client via a `??` prefix.