What is Parquet?
Apache Parquet is an open-source columnar file format for analytics. A Parquet file stores each column separately, typed and compressed, with statistics that let a query engine read only the columns and row groups a query needs.
How a Parquet file is laid out
- Row groups. The file is split horizontally into row groups of a configurable size. DuckDB writes 122,880 rows per group by default.
- Column chunks. Inside a row group, each column is stored on its own, split into pages.
- Encoding and compression. Pages are encoded (dictionary, run-length, delta) and then compressed with a codec such as Snappy or Zstd.
- Footer. The end of the file holds the schema, the byte offset of every column chunk, and min, max and null counts per chunk.
A reader fetches the footer first, then only the byte ranges it needs. That is why Parquet works well on object storage like S3: a query that touches two columns and one month of data issues a few range requests instead of downloading the whole file.
Inspecting a Parquet file in DuckDB
COPY (
SELECT range AS id,
range % 1000 AS customer_id,
round(random() * 100, 2)::DECIMAL(10,2) AS amount,
DATE '2026-01-01' + (range // 27398)::INT AS order_date
FROM range(10_000_000)
) TO 'orders.parquet' (FORMAT parquet);
-- Footer facts: rows and row groups
SELECT num_rows, num_row_groups FROM parquet_file_metadata('orders.parquet');
-- Types stored in the file
SELECT name, type, converted_type FROM parquet_schema('orders.parquet');
-- Encoding, compression and statistics per column chunk
SELECT path_in_schema, encodings, compression,
stats_min_value, stats_max_value, total_compressed_size
FROM parquet_metadata('orders.parquet')
WHERE row_group_id = 0;The file has 10 million rows in 82 row groups. In the first row group, customer_id, with 1,000 distinct values, is dictionary-encoded and takes about 19 KB, against 490 KB for the unique id column. amount is stored as DECIMAL and order_date as DATE, so every reader gets the same types back.
Parquet vs CSV
| Parquet | CSV | |
|---|---|---|
| File size | 64 MB | 287 MB |
| SELECT sum(amount) | About 5 to 9 ms | About 190 to 220 ms |
| Type of amount on read | DECIMAL(10,2), from the file | DOUBLE, guessed by sniffing |
| Reading one column | Reads that column's chunks | Parses every line |
| Readable in a text editor | No | Yes |
The type row matters more than it looks. Because the CSV amount came back as DOUBLE, the CSV sum differed in the last decimal places from run to run, while the Parquet sum was exact. CSV still has its place: spreadsheets, partner drops and older systems produce it. Converting it to Parquet once, when it lands, is a common first step in a pipeline.
Where Parquet stops
Parquet files are immutable: changing one row means writing a new file. A folder of Parquet files also has no commits. A reader that lists the folder during a write can see half a dataset, and nothing records which files make up the current version. Table formats such as Apache Iceberg add that layer on top of Parquet. See open table format.
In Thunderduck
Parquet files in an S3, GCS, Azure or R2 catalog are read with read_parquet, using a path that starts with the catalog name. Thunderduck resolves it to the bucket and uses the catalog's credentials, so no s3:// URL or key appears in the SQL. A filter on a column the files are sorted or partitioned by reads only the files and row groups that can match. Results can be written back to a bucket as Parquet with COPY (query) TO 'catalog/path/file.parquet'.
Docs: https://docs.thunderduck.ai/data/reading-files/