ClickhouseHellmar BeckerExplainer
ClickHouse Cloud: Fast, Updatable Lookups with the Join Table Engine
Summary
ClickHouse Cloud provides an in-memory Join table engine for precomputed hash-map lookups and joins, aimed at enriching append-only fact data with dimensions that change occasionally. With Join(ANY, LEFT, key), inserting another row for a key acts as an upsert, while joinGet and matching JOIN clauses use the in-memory structure. Open-source Join tables are not distributed and persist each INSERT batch as separate .bin files without automatic compaction, but ClickHouse Cloud transparently uses SharedJoin with MergeTree for ALL or ReplacingMergeTree for ANY. In the demonstrated enrichment query, duplicate inserts for id 1 leave value 42 visible, while the underlying table retains duplicates until merging; the in-memory load applies FINAL and always selects the latest entry, making ANY LEFT suitable for frequently updated dimensions.
Context
Dimensional models separate immutable or append-heavy fact tables from smaller dimension tables that can receive updates. Dictionaries support fast direct joins but are refreshed according to configured lifetimes, prompting the question of whether dimension data can be updated like a regular table. Open-source Join tables also have distribution and persistence limitations for frequent updates.
Approach / What changed
Use a Join table with configured strictness, join type, and key columns. In ClickHouse Cloud, Join tables are transparently backed by SharedJoin and a MergeTree-family table: MergeTree for ALL joins and ReplacingMergeTree for ANY joins. Inserts update the persistent table and the in-memory representation, with FINAL applied for ANY joins to retain only the newest data.
Takeaways
Join(ANY, LEFT, id) treats a later insert with the same key as an upsert and exposes the latest value in enrichment queries.
Open-source Join tables keep one compressed Native-format .bin file per INSERT batch and have no automatic background compaction, so repeated updates can degrade performance.
ClickHouse Cloud's SharedJoin backing automatically clusters Join tables and uses ReplacingMergeTree for ANY joins, retaining duplicates in storage until merges while presenting deduplicated in-memory results.
Source and freshness
- Source
- clickhouse.com
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.