Join Types supported in ClickHouse
ClickHouse supports all standard SQL join types plus analytics-oriented variants: INNER, LEFT/RIGHT/FULL OUTER, CROSS, LEFT/RIGHT SEMI, LEFT/RIGHT ANTI, LEFT/RIGHT/INNER ANY, and ASOF joins. Each type is illustrated with Venn diagrams and runnable queries against a normalized IMDB dataset. The examples show ClickHouse-specific behaviour: non-matching rows get default values rather than NULLs unless configured otherwise. A CROSS JOIN with a WHERE join condition is rewritten into an ALL INNER JOIN, visible via EXPLAIN SYNTAX. ANY joins disable the cartesian product and return only the first match.
Related posts
- Choosing the Right Join Algorithm
ClickHouse mediumAdept
ClickHouse offers six join algorithms (direct, hash, parallel hash, grace hash, full sorting merge, partial merge), and the right choice depends on speed, memory and supported join types. Benchmarks on 100M- and 1B-row IMDB tables show direct and parallel hash joins are fastest but memory-hungry. Full sorting merge becomes competitive or faster with far less memory when the physical row order matches the join key, and partial merge is the slowest but leanest. Grace hash trades memory for speed via its bucket count. The post provides decision trees and recommends benchmarking with realistic data, since data volume, types and key distribution can flip the rankings.
- 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.
- ClickHouse Release 25.10
ClickHouse mediumAdept
ClickHouse 25.10 focuses on JOIN performance, adding lazy columns replication (an index column pointing at the original data instead of copying duplicated values), runtime Bloom filters built from the right-side join keys and applied as PREWHERE on the left side for parallel hash joins, push-down of OR conditions that reference both join sides, and automatic column statistics via auto_statistics_types to feed join reordering. Benchmarks on an m6i.8xlarge show a self-join over 20× faster with lazy replication, a TPC-H join 2.1× faster with ~7× less memory using runtime filters, and 24× faster with 60× less memory from disjunction push-down. The release also introduces the QBit bit-sliced vector type for query-time precision tuning, plus SQL additions such as general support for the <=> operator.
- ClickHouse Release 26.7
ClickHouse mediumAdept
ClickHouse 26.7 ships 61 features, 112 performance optimizations and 329 bug fixes, led by a fused ordered-aggregation pipeline that pushes LIMIT into in-order GROUP BY. On TPC-H SF100 it made a Top-N order-summary query 313× faster with 592× less memory by stopping reads once N groups complete. JOIN gains include runtime filters from the build side that skip probe-side granules via primary-key and skip-index analysis (6.2× faster on a selective TPC-H join), compact 8-byte row references in hash tables (median 12% faster, 15% less memory), and a new dpsub join-ordering algorithm that can chain with greedy as a fallback. Vector search also improves through QBit additions such as Int8 support, strided storage, randomized Hadamard rotations and quantization codecs, alongside phrase search, EXPLAIN ANALYZE and unified URL access.