---
title: "ClickHouse gets lazier (and faster): Introducing lazy materialization"
description: "ClickHouse 25.4 adds lazy materialization, which defers reading column data until the query plan actually needs it."
url: "https://swe.quest/articles/clickhouse-gets-lazier-and-faster-introducing-lazy-materialization-c876250ed7371b97"
canonical: "https://clickhouse.com/blog/clickhouse-gets-lazier-and-faster-introducing-lazy-materialization"
source: "ClickHouse"
published: "2025-04-22"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 18
tags: ["query-engines","analytics","performance","storage-engines"]
---

# ClickHouse gets lazier (and faster): Introducing lazy materialization

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2025-04-22, 18 min read, Deep dive. Original: [https://clickhouse.com/blog/clickhouse-gets-lazier-and-faster-introducing-lazy-materialization](https://clickhouse.com/blog/clickhouse-gets-lazier-and-faster-introducing-lazy-materialization)

## Summary

ClickHouse 25.4 adds lazy materialization, which defers reading column data until the query plan actually needs it. For Top N queries with ORDER BY and LIMIT, large SELECT columns are read only for the few rows that survive sorting and limiting. Layered on top of columnar storage, sparse primary indexes and PREWHERE, it cut a query over a 150M-row Amazon reviews table from 219 seconds to 139 ms (1,576×) with no SQL changes. The walkthrough also measures each layer's contribution on cold cache, showing that disk throughput, not CPU, dominates the cost of reading large string columns.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Query engines](https://swe.quest/tags/query-engines.md) (Data & databases)
- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Storage engines](https://swe.quest/tags/storage-engines.md) (Data & databases)

## Prerequisites

- columnar storage basics
- SQL ORDER BY and LIMIT ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- database indexes ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))

## Keywords

ClickHouse, lazy materialization, PREWHERE, MergeTree, Top N queries

## Related posts

- [ClickHouse Release 25.4](https://swe.quest/articles/clickhouse-release-25-4-70f4ff42cabe956e.md): ClickHouse · 2025-05-09 · Medium · 9 min read · Analytics & OLAP, Query engines, Performance engineering, SQL
  ClickHouse 25.4 adds lazy materialization, which defers reading column data until it is needed.
- [Super charging your ClickHouse queries](https://swe.quest/articles/super-charging-your-clickhouse-queries-55ad4f3a6c2fa875.md): ClickHouse · 2022-12-15 · Medium · 15 min read · Analytics & OLAP, Performance engineering, Query engines, SQL
  ClickHouse query speed comes mainly from reading less data: a sparse primary index stores one entry per 8192-row granule and lets binary search skip blocks that can't match the WHERE clause.
- [ClickHouse Release 25.12](https://swe.quest/articles/clickhouse-release-25-12-e571148b4347f1f0.md): ClickHouse · 2026-01-14 · Hard · 18 min read · Query engines, Analytics & OLAP, Performance engineering, Databases
  ClickHouse 25.12 ships 26 features, 31 performance optimizations and 129 bug fixes, led by three query-engine speedups.
- [Top 10 best practices tips for ClickHouse](https://swe.quest/articles/top-10-best-practices-tips-for-clickhouse-4df5699bf7bd75dd.md): ClickHouse · 2026-03-26 · Medium · 21 min read · Analytics & OLAP, Performance engineering, Databases, SQL
  Ten practices for getting performance and storage efficiency out of ClickHouse, each measured on a 150M-row Amazon reviews dataset.
- [Using Materialized Views in ClickHouse](https://swe.quest/articles/using-materialized-views-in-clickhouse-f547ca7b5675b5e9.md): ClickHouse · 2023-01-19 · Medium · 13 min read · Analytics & OLAP, SQL, Performance engineering, Data pipelines
  ClickHouse materialized views act as insert-time triggers that write the result of a SELECT into a target table, letting expensive aggregations be precomputed.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
