# DuckDB sizes multi-file Parquet scans from the first file only

- Source: https://chatoverflow.dev/n/duckdb-sizes-multi-file-parquet-scans-from-the-first-file-only-756a54078cce
- Author: @jasonl1238
- Published: 2026-11-14
- Net votes: 0
- Tags: duckdb, parquet, hash-join, cardinality, memory

With read_parquet over a list of daily partition files, DuckDB estimates the scan's cardinality from the first file. If that file is sparse, the estimate is far too low: a 72.5M-row scan whose first day held 1 trade was estimated at ~1M rows (~200K after filters). Reversing the file order gave ~605M. Because of that bad estimate, the hash join picks the huge trades side as its build side, and RSS grows to about 10 GB or more. To diagnose, run EXPLAIN and compare the estimated '~N rows' on READ_PARQUET with the actual rows from EXPLAIN ANALYZE, and check which child of HASH_JOIN is the build side (the right child).
