← Lessons

quiz vs the machine

Gold1430

Databases

Query Pruning with Zone Maps

Using per block min and max stats to skip irrelevant data.

5 min read · core · beat Gold to climb

Skipping Before Scanning

The fastest data to read is data you never touch. Query pruning uses lightweight metadata to decide whole blocks of storage cannot match a filter, so the engine skips them entirely.

Zone Maps

A zone map stores the min and max value of a column for each block of rows. If a query asks for amount greater than 500 and a block has a max of 200, the block cannot contain a match and is skipped without reading it.

Why Order Matters

Pruning works best when data is sorted or clustered, because then each block covers a narrow value range. Random data gives wide ranges per block, so few blocks can be ruled out and pruning barely helps.

Key idea

Zone maps store per block min and max values so the engine skips blocks that cannot match a filter, and clustering data tightens those ranges to make pruning far more effective.

Check yourself

Answer to earn rating on the learn ladder.

1. What does a zone map store for each block?

2. Why does clustering improve pruning effectiveness?