Setting the file. One moment.
Chapter 04 · Clickhouse Best Practices
Subchapter 4.19
rules/query-join-null-handling.mdMarkdown1 KBView on GitHub
Impact: MEDIUM
Set join_use_nulls = 0 to use default column values instead of NULL markers, reducing memory overhead compared to Nullable wrappers.
-- Use default values instead of NULLs for non-matching rows
SET join_use_nulls = 0;
SELECT o.order_id, c.name
FROM orders o
LEFT JOIN customers c ON c.id = o.customer_id;
-- Non-matching rows get '' for name instead of NULLWhen to use:
| Setting | Behavior | Use Case |
|---|---|---|
join_use_nulls = 0 (default) | Default values (empty string, 0) for non-matches | When you can handle default values |
join_use_nulls = 1 | NULL for non-matches | When you need to distinguish “no match” from “matched with default” |