# Inside a Parquet file: row groups, pages, encodings, statistics and compression measured

Parquet decides how much of your data lake a query actually reads. We write two million rows four ways and measure the result: 62 MB as CSV, 17.5 MB as sorted Parquet with zstd, and a filtered query that reads 1.1 MB instead of 13.3 MB just because the rows were sorted.

Apache Parquet is the default file format of the modern data lake. Delta Lake, Apache Iceberg and Apache Hudi tables all store their data in Parquet files, and engines from Spark to DuckDB to Snowflake read it natively. Yet most teams treat Parquet as a black box: write a DataFrame, hope for the best. The layout inside the file decides how much a query reads, how much storage you pay for and how fast scans run.

This article opens the box. It explains the structure of a Parquet file, the encodings and compression codecs that shrink it, and the statistics that let engines skip data. Then it measures all of it on a two-million-row example written with PyArrow 26 and queried with DuckDB 2.0, so every number can be reproduced.

## What happened

### Apache Arrow 26.0.0 hardens Parquet reading (8 October 2026)

The Apache Arrow project released version 26.0.0, which includes the C++ Parquet implementation used by PyArrow. The release post lists a security fix, CVE-2026-92287: KMS URLs embedded in encrypted Parquet files were forwarded to user-implemented key management clients, and reading them is now disabled by default (`read_kms_url=false`). The release also limits schema nesting depth when parsing Parquet's Thrift metadata (default limit 100), tolerates unrecognised combinations of logical and physical types, and fixes level histograms in Parquet size statistics that could be wrong for inputs spanning multiple chunks. PyArrow 26.0.1 followed on PyPI on 3 November 2026.

### DuckDB 2.0.1 LTS (20 November 2026)

DuckDB released 2.0.1, the first patch release of its 2.0 long-term support line. Among the changes that may require action, the release post says host- and bucket-scoped `SECRET`s now match a URL only if it is identical to the scope or continues with a `/`. That matters for anyone reading Parquet from object storage with scoped credentials, because a scope such as `s3://sales` could previously also match `s3://sales-archive`.

## The anatomy of a Parquet file

A Parquet file is organised like a book with chapters, paragraphs and an index at the back.

- **Row group**: a horizontal slice of the rows. The Parquet specification describes it as a logical horizontal partitioning of the data. Think of it as a chapter.
- **Column chunk**: the data for one column inside one row group. Column chunks are contiguous in the file, which is what makes Parquet columnar: a query that needs two columns reads two chunks per row group, not whole rows.
- **Page**: the unit of encoding and compression inside a column chunk. A column chunk is a sequence of pages, optionally starting with a dictionary page.
- **Footer**: file metadata at the end of the file. It records the schema, every row group's location, and statistics such as min and max values for each column chunk.

A reader opens the footer first, like checking a book's index. From the footer alone it can decide which row groups and which columns it needs, then fetch only those byte ranges. On object storage such as [Amazon S3](/tools/amazon-s3), where every request has latency, reading less and in fewer requests is the main performance lever.

The specification's own guidance recommends large row groups (512 MB to 1 GB) for sequential scans in Hadoop-style systems, and 8 KB data pages. Engines choose their own defaults, though. DuckDB's documentation gives a default `ROW_GROUP_SIZE` of 122,880 rows and suggests, as a rule of thumb, at least as many row groups per file as CPU threads that will read it.

### Nulls and nested data

Parquet stores nulls and nested structures without placeholder values. Each value in a column chunk can carry a **definition level**, which says how many optional fields along its path are actually present, and a **repetition level**, which says where a new list element starts. A flat, non-nullable column needs neither, so it costs nothing. A nullable column needs only definition levels, which are run-length encoded and nearly free when most values are present. This scheme, borrowed from Google's Dremel paper, is why a column of lists or structs can still be read column by column and why engines can project a single nested field, such as `address.city`, without decoding the rest of the record.

In practice this means wide, nested event payloads are not a reason to abandon Parquet. Flattening the fields that are filtered or aggregated most often still helps, because statistics and dictionary encoding work best on simple top-level columns.

## Encodings: shrinking before compressing

Parquet applies two layers of size reduction. First an **encoding** that exploits the structure of the values, then a general-purpose **compression codec** over the encoded pages.

The main encodings in the specification:

| Encoding | How it works | Good for |
|---|---|---|
| PLAIN | Values stored one after another | Fallback for anything |
| RLE_DICTIONARY | Distinct values stored once in a dictionary page; data pages hold small integer ids, run-length and bit-packed | Low- and medium-cardinality strings and numbers |
| DELTA_BINARY_PACKED | Stores differences between consecutive integers, bit-packed | Sorted ids and timestamps |
| DELTA_LENGTH_BYTE_ARRAY and DELTA_BYTE_ARRAY | Delta-encodes string lengths, or shared prefixes | Strings with common prefixes such as URLs |
| BYTE_STREAM_SPLIT | Splits floating-point bytes into separate streams to help compression | Floats and doubles |

Dictionary encoding is the workhorse. A `country` column with eight distinct values over 250,000 rows becomes a tiny dictionary plus 250,000 three-bit ids, which run-length encoding shrinks further when equal values sit next to each other. The specification marks the older `PLAIN_DICTIONARY` value as deprecated in favour of `RLE_DICTIONARY`.

The analogy is a seating plan. Instead of writing each guest's full name on every seat, you number the guests once and write the numbers on the seats.

## Statistics and predicate pushdown

For each column chunk, writers usually store the minimum, maximum and null count. A query with `WHERE event_ts BETWEEN a AND b` can skip any row group whose min-max range does not overlap the filter. This is called predicate pushdown, and it is the same idea as zone maps in warehouses or granule pruning in ClickHouse.

Statistics only help if values are clustered. If each row group contains timestamps from the whole year, every row group's range overlaps every filter and nothing is skipped. Sorting before writing is therefore not cosmetic. It is the difference between reading one row group and reading all of them.

## A measured example

We generated two million event rows with five columns: a timestamp in seconds over 90 days, a country code from eight values, a status (`ok` or `refund`), a user id and an amount. We wrote the same data in several ways with PyArrow 26.0.1, using 250,000-row row groups so each file has eight row groups.

```python
import pyarrow.parquet as pq

# t is a pyarrow.Table sorted by event_ts
pq.write_table(t, "events_zstd.parquet", compression="zstd",
               row_group_size=250_000)
pq.write_table(t, "events_snappy.parquet", compression="snappy",
               row_group_size=250_000)
pq.write_table(t, "events_none.parquet", compression="none",
               row_group_size=250_000)
```

### File size by format and codec

| Layout | Size |
|---|---|
| CSV | 62.2 MB |
| Parquet, no compression (encodings only) | 37.8 MB |
| Parquet, Snappy | 25.1 MB |
| Parquet, zstd | 17.5 MB |
| Parquet, zstd, rows shuffled | 22.2 MB |

Encodings alone cut the CSV by about 40 percent. Zstd then roughly halved the result. Shuffling the same rows made the zstd file about 27 percent larger, because sorted timestamps produce small, regular differences that compress well, while random order destroys that pattern.

The file metadata shows the encodings PyArrow chose. For the first row group, the `country` column used `RLE_DICTIONARY` and its compressed chunk was 95,023 bytes against 94,884 uncompressed: dictionary ids were already so compact that zstd had nothing left to remove. The `amount` column, with many distinct values, also tried a dictionary and shrank from 629,128 to 528,765 bytes. Codecs help most on columns that encodings cannot reduce.

### Bytes read by a filtered query

Next we asked DuckDB for the total amount on day 31, a one-day window, and used `EXPLAIN ANALYZE` to see what it read.

```sql
SELECT sum(amount)
FROM 'events_zstd.parquet'
WHERE event_ts BETWEEN 2592000 AND 2678399;
```

| File | Row groups scanned | Data read | Result |
|---|---|---|---|
| Sorted Parquet, zstd | 1 of 8 | 1.1 MB | 22,196 rows |
| Shuffled Parquet, zstd | 8 of 8 | 13.3 MB | 22,196 rows |
| CSV | whole file | 62.1 MB | 22,196 rows |

Both Parquet files return the same answer. The sorted file lets the footer statistics rule out seven of eight row groups, and column pruning means only the `event_ts` and `amount` chunks are read. The shuffled file must scan everything, reading about twelve times more. The CSV has no statistics and no columns to skip, so it reads every byte.

You can check row group statistics yourself:

```python
md = pq.ParquetFile("events_zstd.parquet").metadata
for i in range(md.num_row_groups):
    s = md.row_group(i).column(0).statistics
    print(i, md.row_group(i).num_rows, s.min, s.max)
```

In the sorted file, row group 3 covers timestamps 2,917,093 to 3,889,728, and the day-31 window (2,592,000 to 2,678,399) falls entirely inside row group 2.

## Partitioning and file sizing

Inside files, sorting and statistics prune row groups. Across files, directory partitioning prunes whole files. Hive-style partitioning writes paths such as `events/event_date=2026-10-13/part-0.parquet`, and engines skip directories whose partition values do not match the filter. DuckDB, for example, writes this layout with `COPY ... TO 'events' (FORMAT parquet, PARTITION_BY (event_date))`.

| Choice | Benefit | Risk |
|---|---|---|
| Partition by a low-cardinality column used in most filters (date, region) | Whole files skipped without opening them | Too many partitions if the column has high cardinality |
| Sort within files by the next most common filter | Row group pruning inside each file | Sorting costs write time |
| Larger files (hundreds of MB) | Fewer requests, better compression | Less parallelism for small tables |
| Many tiny files | Easy streaming writes | Slow listing and planning, poor compression: the small files problem |

Open table formats such as [Apache Iceberg](/tools/apache-iceberg) and [Delta Lake](/tools/delta-lake) add their own metadata on top of these files, so they can prune files from statistics without listing directories and can compact small files later. The [storage and formats topic page](/topics/big-data/storage-and-formats) covers how these layers fit together.

## What it means in practice

Three choices control most of a lake's cost and speed: the sort order inside files, the row group and file size, and the partition columns. Codec choice matters less than people think: zstd is a sensible default for cold and warm data, and Snappy trades size for slightly cheaper decompression.

When you write Parquet from [PySpark](/tools/pyspark), sort or cluster by the columns most queries filter on before writing. When you use DuckDB or [Polars](/tools/polars), set the row group size deliberately. When you read, check that your engine reports skipped row groups; if it does not, your statistics are probably useless because the data is not clustered. The in-memory side of this story, [Apache Arrow](/tools/apache-arrow), is what most Python engines decode Parquet into.

## What to do now

1. **Inspect a real file's footer.** Use `pyarrow.parquet.ParquetFile(...).metadata` to list row groups, encodings and min-max statistics for your largest table.
2. **Sort by the main filter column before writing.** Re-run a typical query and compare row groups scanned.
3. **Switch cold data to zstd.** Measure the size difference against Snappy on a sample before converting everything.
4. **Set row group sizes on purpose.** Aim for at least as many row groups per file as reader threads, and avoid tiny groups.
5. **Partition by date or another low-cardinality filter.** Avoid partitioning by user id or any column with thousands of values per day.
6. **Compact small files.** Schedule compaction for streaming outputs so files reach a healthy size.
7. **Upgrade readers that handle encrypted Parquet.** Arrow 26.0.0 disables reading KMS URLs from files by default; configure the KMS URL explicitly.
8. **Review scoped secrets after upgrading DuckDB.** In 2.0.1, bucket and host scopes match more strictly, so check that each scope names the full bucket.

## Risks and open questions

**Sorting helps one filter at a time.** A file sorted by timestamp prunes poorly for a user id filter; multi-column clustering techniques such as Z-ordering or liquid clustering in table formats trade a little of each.

**Statistics can be missing or truncated.** Some writers skip statistics for long strings or certain types, so pruning silently stops working for those columns.

**Over-partitioning creates the small files problem.** Thousands of tiny files slow planning and listing more than they help pruning.

**Security fixes can change behaviour.** The Arrow 26 change to KMS URL handling can break pipelines that relied on URLs embedded in files.

**Watch next:** how quickly engines adopt newer Parquet features such as size statistics and geospatial types, and whether file-level statistics give way to richer indexes managed by table formats.

## Frequently asked questions

### What is a Parquet row group?

A row group is a horizontal slice of the rows in a Parquet file. It contains one column chunk per column, and its statistics let readers skip it entirely when a filter cannot match.

### Is zstd or Snappy better for Parquet?

In our test, zstd produced a 17.5 MB file against 25.1 MB for Snappy on the same data. Zstd usually gives smaller files, while Snappy is very cheap to decompress; for most analytical data zstd is a good default.

### Why does sorting make Parquet smaller and faster?

Sorted values compress better because neighbouring values are similar, and min-max statistics per row group become narrow, so filters skip more row groups. In our example, sorting cut data read for a one-day query from 13.3 MB to 1.1 MB.

### How big should Parquet files be?

Large enough to avoid the small files problem and small enough to give parallelism. Hundreds of megabytes per file is a common target for lakes, with row groups sized so each file has several of them.

### Do Delta Lake and Iceberg replace Parquet?

No. They store data in Parquet files and add a metadata layer for transactions, schema evolution and file-level statistics. Good Parquet layout still decides how fast their scans are.

## Summary

A Parquet file is a set of row groups, each holding one column chunk per column, split into pages and described by a footer with schema and statistics. Encodings such as dictionary and delta shrink data before codecs such as zstd compress it, and min-max statistics let engines skip row groups. In our measurement, two million rows took 62.2 MB as CSV and 17.5 MB as sorted Parquet with zstd, and a one-day query read 1.1 MB from the sorted file versus 13.3 MB from a shuffled one. Arrow 26.0.0 and DuckDB 2.0.1, released in October and November 2026, also tightened security around encrypted files and scoped storage secrets.

## Sources

- [GitHub: Apache Parquet format specification README](https://github.com/apache/parquet-format/blob/master/README.md)
- [GitHub: Apache Parquet encodings specification](https://github.com/apache/parquet-format/blob/master/Encodings.md)
- [Apache Arrow: Apache Arrow 26.0.0 Release](https://arrow.apache.org/blog/2026/10/08/26.0.0-release/)
- [PyPI: pyarrow release history](https://pypi.org/project/pyarrow/#history)
- [DuckDB: Announcing DuckDB 2.0.1 LTS](https://duckdb.org/2026/11/20/announcing-duckdb-201.html)
- [GitHub: DuckDB docs, Parquet tips](https://github.com/duckdb/duckdb-web/blob/main/docs/2.0/data/parquet/tips.md)
- [GitHub: DuckDB docs, Hive partitioning](https://github.com/duckdb/duckdb-web/blob/main/docs/2.0/data/partitioning/hive_partitioning.md)
