Databricks & Snowflake · Chapter 2 of 10
Files, columns and compression
Why analytics runs on Parquet. The single idea that makes everything above it possible.
Everything in this book sits on top of one decision: store data by column rather than by row.
What Parquet actually is
- Columnar, on disk. Values for one column are stored contiguously, so reading one column is one sequential read.
- Chunked into row groups. A file is split into row groups — typically 128MB — and within each, into column chunks. This is what allows parallel reading.
- Self-describing. The schema is in the file footer, so a reader needs no external catalogue to parse it.
- Statistics per chunk. Min, max and null count for each column in each row group. This is the important one: a query filtering
WHERE date = '2026-08-01'can skip an entire row group whose max date is earlier, without reading it. That is called predicate pushdown and it is where most of the speed comes from. - Encoded before compressed. Dictionary encoding replaces repeated values with small integers; run-length encoding collapses repeats. Then general compression on top. A region column with twelve distinct values across a billion rows becomes almost nothing.
The practical consequences you will meet
| Symptom | Cause | Fix |
|---|---|---|
| Queries slow despite small result | Reading every row group because statistics cannot help | Sort or cluster the data by the column you filter on |
| Thousands of tiny files | Frequent small writes, each producing files | Compaction — rewrite into fewer, larger files |
| One file, no parallelism | A single large file or a non-splittable compression codec | Target ~128MB–1GB files; use Snappy or ZSTD rather than plain gzip on a whole file |
| Wide table, slow scans | Selecting * when you need four columns | Select the columns you need — with columnar this is a real saving, unlike in a row store |
The habit that makes you faster than most people
Filter on a column the data is physically ordered by. Partitioning and clustering exist so that statistics can eliminate files before reading them. A query that filters on an unordered column has to read everything, no matter how good the engine is.
That single principle explains most of the performance advice in chapters 7 and 8, on both platforms.