Parquet vs CSV: same table, 5× smaller, 7–10× faster, and why
What a Parquet file actually stores (row groups, column chunks, pages, a footer with min/max stats) versus a CSV, why the same table ends up about 5× smaller and is queried 7–10× faster in DuckDB's published test, and when CSV is still the right choice.
Save one table twice. In a test the DuckDB team published, the TPC-H lineitem table at scale factor 20 (about 120 million order lines, 16 columns) came out at 15.95 GB as CSV and 3.22 GB as Parquet with Zstd, or 3.78 GB with Snappy. Then they ran the same query straight on both files: 6.72 seconds on the CSV, 0.88 seconds on the Parquet file.
“Parquet vs CSV” is the first thing Google suggests after “parquet vs”, and most answers stop at “Parquet is columnar and compressed”. That’s true, but it’s not the main reason for the speed. This post looks at what each file actually contains, which part of the gap comes from size and which from skipping, and when CSV is still the better pick. All numbers are other people’s published measurements, linked inline. Nothing was benchmarked for this post.
The test behind the numbers
The figures come from Pedro Holanda’s post CSV Files: Dethroning Parquet as the Ultimate Storage File Format — or Not? on the DuckDB blog (December 5, 2024). The setup: an Apple M1 Max with 64 GB of RAM, TPC-H scale factor 20 (the TPC-H spec sizes lineitem at about SF × 6,000,000 rows), schemas given upfront, everything kept in memory, median of 5 runs.
| lineitem, TPC-H SF20 | Size | Load into a table | Q1 on the file | Q21 on the files |
|---|---|---|---|---|
| CSV | 15.95 GB | 11.76 s | 6.72 s | 19.95 s |
| Parquet, Snappy | 3.78 GB | 5.21 s | 0.88 s | 2.08 s |
| Parquet, Zstd (level 1) | 3.22 GB | 5.52 s | 0.95 s | 2.12 s |
Look at the pattern. Loading the whole table is only about 2× apart. Querying the files directly is about 7× (Q1) and about 10× (Q21) apart. If size were the whole story, all three gaps would look alike. They don’t, because querying lets Parquet skip data and loading doesn’t.
What a CSV contains
A CSV is text: one record per line, fields separated by commas. Its “standard”, RFC 4180 from October 2005, is an Informational RFC, and its status section says it “does not specify an Internet standard of any kind”. Even the header line is optional. The DuckDB post notes that the RFC “is commonly ignored” in practice, so every reader has to guess delimiters, quoting and types.
Three things follow from “it’s just text”:
- No types. A number is characters. DuckDB’s example:
1000000000takes 10 bytes as text and 4 bytes as anint32. - No summary. Nothing in the file says where a value is, or what range of dates a block of lines covers. To answer anything, a reader starts at the first byte.
- Row order. Each line mixes all columns, so the per-column tricks (dictionaries, run lengths) don’t apply.
The reader can still avoid converting columns it doesn’t need, which DuckDB’s CSV reader does (projection pushdown). But in the post’s words, “it still must parse the value to be able to skip it”, and with no partitions or statistics, “it can’t efficiently skip parts of the data”.
What a Parquet file contains
The Apache Parquet format spec describes a file as nested boxes:
- Row groups: “a logical horizontal partitioning of the data into rows”. The spec recommends large ones, 512 MB to 1 GB.
- Column chunks: inside each row group, one chunk per column.
- Pages: each chunk is split into pages, “an indivisible unit (in terms of compression and encoding)”. The spec suggests 8 KB.
- The footer: file metadata with the schema and real types, the position of every column chunk, row counts, and statistics (min, max, null count) per column chunk.
The order is deliberate. The file starts and ends with the 4 magic bytes PAR1, and the footer comes after the data: “File Metadata is written after the data to allow for single pass writing.” A reader goes the other way. It reads the last 8 bytes (the footer’s length and PAR1), then the footer, and then only the column chunks it needs. In the spec’s words, “Readers are expected to first read the file metadata to find all the column chunks they are interested in.”
Inside a page, values of one column sit together, so encodings work well: a dictionary per column chunk turns repeated strings into small codes, and the RLE / bit-packing hybrid stores runs of the same code as a count. After that, each page can be compressed with Snappy, gzip, Brotli, Zstd or LZ4_RAW, among others.
Question 1: how big? The gzip twist
About 5× smaller in DuckDB’s test, which is what most comparisons show. But compare a CSV that has been gzipped. ClickHouse publishes the ClickBench table (99,997,497 rows, 105 columns) in several formats. The publisher’s own file sizes:
ClickBench hits file |
Size | Can you query it as is? |
|---|---|---|
hits.csv (uncompressed) |
about 82 GB (DuckDB’s figure) | yes, by reading every byte |
hits.csv.gz |
16.6 GB (16,608,960,810 bytes) | no: decompress first |
hits.json.gz |
23.7 GB | no: decompress first |
hits.parquet |
14.8 GB (14,779,976,446 bytes) | yes, and it can skip |
The gzipped CSV is only 12% bigger than the Parquet file. (ClickBench even calls its Parquet file “intentionally dirty”, with “no proper logical data types”.) So if all you need is a small file to archive or send, gzip gets you most of the way. What gzip can’t give you is the ability to not read most of the file. That’s question 2 and 3.
Question 2: which columns?
TPC-H Q1 “projects 7 out of the 16 columns” of lineitem. A Parquet reader uses the footer to fetch only those 7 column chunks from each row group; the other 9 are never read from disk or decompressed. DuckDB’s docs put it simply: “only the columns required for the query are read.” The CSV reader has to walk through all 16 columns on every line to find where the 7 it wants begin.
Question 3: which rows?
Q1 also filters on l_shipdate <= DATE '1996-09-02', which removes about 30% of the data. Parquet’s footer holds the min and max of l_shipdate for every row group. If even a row group’s minimum is later than the cut-off, no row in it can match, so the reader skips the whole group. DuckDB: “In the Parquet file, we can directly skip row groups that do not match our filter.” ClickHouse does the same by default (input_format_parquet_filter_push_down = 1: “skip whole row groups based on the WHERE/PREWHERE expressions and min/max statistics”). Newer files can also carry a page index with min/max per page, so a reader can skip pages inside a chunk.
This only pays off when the data is clustered by the filter column. If every row group holds dates from every year, every min/max range overlaps the filter and nothing is skipped. Sorting by the column you filter on most is the cheapest speed-up you can give a Parquet file.
Q21 joins four tables, and Parquet’s statistics help there too: the post blames part of the CSV’s 10× on “join ordering with no statistical information for the CSV file”.
A twist: 42.parquet
The footer is powerful because readers trust it. DuckDB’s Hannes Mühleisen used that to build 42.parquet, a valid 42 kB file. It holds one dictionary value, a run length of 2³¹−1, a data page repeated 1,000 times and row groups repeated 290 times, all pointing at the same bytes. That comes to 622,770,257,630,000 values, “over 4 petabytes” if you load them all. If you read Parquet files from people you don’t know, set memory limits, row limits or timeouts first.
When CSV is still the right choice
The DuckDB post concludes that Parquet “is still the undisputed champion for most scenarios”, but also: “if you have small files and need flexibility, CSV files are fine”. In practice, use CSV when:
- A human reads or edits it. Any text editor or spreadsheet opens it. (Excel stops at 1,048,576 rows, so the 100-million-row ClickBench CSV wouldn’t fit anyway.)
- The file is tiny. A footer and row groups buy nothing for 200 rows.
- You append line by line. A log or a stream can add one line at a time. A Parquet file is finished once its footer is written; to add rows, you usually write a new file.
- The other side can only do text. DuckDB’s post names exports from legacy systems as exactly the job a fast CSV reader is for.
Converting, and the two knobs
DuckDB can copy a CSV straight to Parquet (COPY docs):
COPY 'data.csv' TO 'data.parquet' (FORMAT parquet, COMPRESSION zstd);
ClickHouse can do it without a server through clickhouse-local and its Parquet format:
clickhouse-local -q "SELECT * FROM file('data.csv') INTO OUTFILE 'data.parquet' FORMAT Parquet"
Two settings are worth knowing:
| Setting | Parquet spec | DuckDB default | ClickHouse default |
|---|---|---|---|
| Row group size | “large row groups (512MB - 1GB)” | 122,880 rows | 1,000,000 rows / 512 MiB (uncompressed) |
| Compression | per column, many codecs | Snappy | Zstd |
Bigger row groups mean fewer footer entries and longer sequential reads. Smaller ones give min/max skipping more chances to work. For compression, Snappy (DuckDB’s default) is built for speed, and Zstd for ratio. In the test above, Zstd was 15% smaller (3.22 vs 3.78 GB) and only slightly slower (0.95 vs 0.88 s on Q1, 5.52 vs 5.21 s to load). For files that are written once and read many times, Zstd is usually the better trade.
The short version
- A CSV is text with no types, no index and no summary, so every question means reading the whole file.
- A Parquet file is row groups → column chunks → pages, with a footer of schema, offsets and min/max statistics at the back.
- Same table in DuckDB’s test: about 5× smaller, Q1 about 7× faster, Q21 about 10× faster, loading only about 2× faster.
- A gzipped CSV is almost as small (16.6 vs 14.8 GB for ClickBench), so the real win is skipping, not size.
- Keep CSV for humans, tiny files, append-only logs and legacy exports. Convert everything you query.