---
title: "Index-based pruning in ClickHouse"
description: "ClickHouse offers three index-based ways to skip data: the sparse primary index (one entry per 8,192-row granule), lightweight projections that store only a sort key plus a _part_offset pointer into the base table, and skip indexes such as minmax that keep per-granule min/max values."
url: "https://swe.quest/articles/index-based-pruning-in-clickhouse-5952b67ba993450d"
canonical: "https://clickhouse.com/blog/index-based-pruning"
source: "ClickHouse"
published: "2026-04-15"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 21
tags: ["analytics","query-engines","storage-engines","performance"]
---

# Index-based pruning in ClickHouse

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2026-04-15, 21 min read, Deep dive. Original: [https://clickhouse.com/blog/index-based-pruning](https://clickhouse.com/blog/index-based-pruning)

## Summary

ClickHouse offers three index-based ways to skip data: the sparse primary index (one entry per 8,192-row granule), lightweight projections that store only a sort key plus a \_part\_offset pointer into the base table, and skip indexes such as minmax that keep per-granule min/max values. On a 243-million-row UK property sales table, a filter on the leading primary-key column read 1.69 million rows in 15 ms. Filtering only on the second key column fell back to generic exclusion search, scanned 138 million rows and ran 50x slower. Lightweight projections handle filters on non-key columns without duplicating full rows, while minmax indexes cost even less storage but only prune well when the column correlates with the primary key.

Written by swe.quest, not by the author.

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

## Topics

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

## Prerequisites

- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- columnar databases ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))
- ClickHouse MergeTree tables ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))

## Keywords

ClickHouse, MergeTree, lightweight projections, minmax skip index, primary index, UK price paid dataset

## Related posts

- [ClickHouse projections now behave like true secondary indexes](https://swe.quest/articles/clickhouse-projections-now-behave-like-true-secondary-indexes-0baa9f93cd285ce3.md): ClickHouse · 2026-01-13 · Medium · 6 min read · Analytics & OLAP, Query engines, Storage engines, Performance engineering
  ClickHouse lightweight projections, which store only a sorting key plus a \_part\_offset pointer into the base table, now act as true secondary indexes with granule-level pruning instead of only pruning whole parts.
- [How ClickHouse makes Top-N queries faster with granule-level data skipping](https://swe.quest/articles/how-clickhouse-makes-top-n-queries-faster-with-granule-level-data-skipping-c5fa6e048ea4d950.md): ClickHouse · 2026-01-19 · Medium · 9 min read · Query engines, Analytics & OLAP, Performance engineering, Databases
  ClickHouse can now use minmax data-skipping indexes to prune whole granules for ORDER BY … LIMIT N queries before reading any rows.
- [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.
- [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.
- [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.

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)
