Videos
Lazy materialization in ClickHouse
Mark Needham
Discover the power of lazy materialization in ClickHouse 25.4! This game-changing optimization defers column reading for as long as possible, making your top-end queries significantly more efficient, especially when returning string columns in your results.
We show you how lazy materialization works using a real Amazon Reviews dataset with 150 million rows. You'll see the performance difference when the optimization is enabled versus disabled, and understand why this feature is particularly valuable for queries that use ORDER BY with LIMIT clauses.
The demo runs on a 2023 MacBook Pro using a table that contains numeric columns like star_rating and helpful_votes, and string columns including product_title, review_headline, and review_body. This optimization reduces memory usage by only loading the column values you actually need in your final result set, rather than reading entire columns into memory.
This optimization is perfect for data analysts, database administrators, and anyone working with large datasets in ClickHouse. It is especially valuable when filtering and sorting large table,s but only needing to return a small subset of results.