Database / DuckDB Interview questions
What is a zone map, and how does DuckDB use it?
A zone map (also called a min/max index or block-level statistics) is a lightweight summary, typically just the minimum and maximum values, recorded for a chunk of data (like a row group), letting a query engine determine whether that chunk could possibly contain rows matching a filter condition without scanning the chunk's actual contents.
-- if a row group's zone map shows max(order_date) = '2025-06-01', -- and the query filters WHERE order_date > '2026-01-01', -- DuckDB can skip that entire row group without reading it SELECT * FROM orders WHERE order_date > '2026-01-01';
DuckDB maintains zone maps automatically for its own storage format and also reads Parquet's built-in per-row-group statistics when querying Parquet files directly, applying the same pruning logic in both cases. This kind of I/O pruning is especially effective on data with some natural ordering or clustering, like time-series data stored roughly in chronological order, where a date-range filter can skip the vast majority of a large table's row groups outright.
More Related questions...