Bars showing the share of a 177 MB Parquet file DuckDB downloads for six queries, from 0.15 percent to 100 percent

You can run SQL on a big Parquet file that sits in a bucket without downloading it first. DuckDB asks the bucket for the byte ranges it needs and nothing else. How many bytes that is depends a lot on the query, so we counted.

We put a 177 MB Parquet file in an S3 API endpoint, pointed DuckDB 2.0.0 at it with the httpfs extension, and read every request from the proxy's access log. Same file, seven queries, three cold runs each.

The test file

  • 6,000,000 rows, 7 columns: event_id, ts (sorted), user_id, country, status, amount, url (a long hex string).
  • Written by DuckDB with COMPRESSION ZSTD and ROW_GROUP_SIZE 122880: 49 row groups, 177,006,021 bytes.
  • Rows are sorted by ts, so each row group covers its own time slice.
ColumnCompressed bytesShare of file
url111,107,15562.8%
amount19,825,71911.2%
ts18,875,57910.7%
user_id16,909,5359.6%
event_id6,131,7213.5%
country2,733,9421.5%
status1,378,7300.8%

The server was an S3 API gateway on 127.0.0.1 (rclone serve s3, SigV4 on) behind an nginx that logged one line per request. The network is loopback, so we do not quote timings. Requests and bytes are exact, and you can turn them into time for your own link.

What each query fetched

QueryRequests (HEAD + GET)Bytes fetchedShare of fileTransfer at 100 Mbit/s
Row count1 + 1263,6210.15%0.02 s
Rows in one day (sorted ts)1 + 31,062,3410.6%0.08 s
Average of amount1 + 5020,288,96511.5%1.6 s
Two columns, GROUP BY country1 + 9023,438,78913.2%1.9 s
Filter on url (LIKE)1 + 98111,347,14162.9%8.9 s
Every column, full scan1 + 99177,006,021100%14.2 s
Download the file first1177,006,021100%14.2 s

Transfer time is bytes × 8 ÷ 100,000,000 for a 100 Mbit/s link, ignoring latency. Every number in the first three columns repeated exactly in all three cold runs.

Why the numbers look like that

  • Row count: 2 requests. The row count is in the Parquet footer. DuckDB does a HEAD for the size, then one GET of the last 263,621 bytes.
  • One column: 50 GETs. That is the footer plus one GET per row group, 49 of them, each about 400 KB of amount. DuckDB never touched the other 155 MB.
  • One day: 3 GETs. Each row group stores min and max of ts. Because the file is sorted, only one or two row groups can hold June 1, and DuckDB skipped the other 47 without reading them. Sorting before you write is the cheapest speed-up here (DuckDB's own Parquet tips say the same).
  • Long text column: 63% of the file. A filter on a column that holds most of the bytes reads most of the bytes. Parquet cannot skip what it cannot rule out with min/max, and a LIKE '%x%' never can.
  • Full scan: no saving, no loss. 99 GETs, exactly the file size. With many columns requested it needed far fewer GETs than column chunks (343 chunks, 99 GETs), so it clearly reads neighbouring chunks together.

The surprise: LIMIT 10 is not small

<code>SELECT * ... LIMIT 10</code> looks like the cheapest query there is. On the default thread count it fetched between 94 and 145 MB across runs (up to 82% of the file). Each thread starts on its own row group and reads every column of it before the limit can stop anyone. We repeated it with the thread count fixed:

SET threadsGET requestsBytes fetched (identical in 3 runs)
1914,796,229
21729,291,973
43358,279,365
865116,254,149

About 14.5 MB per thread, so the bytes grow with the threads. For a peek at remote data, select the columns you need, or set <code>threads</code> to 1 for the preview.

Asking twice

  • Same connection, same query, file cache on (the default): 1 HEAD, 0 bytes. DuckDB checks the object is unchanged and answers from memory.
  • SET enable_external_file_cache=false: the same average took 51 requests the second time.
  • A new connection starts cold again. Keep one connection open for a session of queries (a notebook, an API process) and the repeat costs almost nothing.

Point DuckDB at an S3-compatible endpoint

sql
INSTALL httpfs; LOAD httpfs;
CREATE SECRET (
  TYPE S3, KEY_ID 'YOUR_KEY_ID', SECRET 'YOUR_SECRET',
  ENDPOINT 's3.example.com', URL_STYLE 'path', REGION 'auto'
);
SELECT country, count(*) FROM read_parquet('s3://my-bucket/events.parquet') GROUP BY 1;
  • URL_STYLE 'path': DuckDB defaults to virtual-host style for S3, which needs bucket.endpoint DNS. Most S3-compatible endpoints want path style. Add USE_SSL false only for a local test like ours.
  • Public file? Skip the secret and read the plain HTTPS URL, read_parquet('https://.../events.parquet'). We ran the same seven queries that way against a public URL: the same request counts and bytes.
  • Globs like s3://bucket/events/*.parquet use ListObjectsV2 first, then one footer read per file.

What to do with this

  • Sort on the column you filter by before writing. It turned a 177 MB file into a 1 MB read.
  • Write columns you query often as their own small columns; keep fat text columns out of the file you scan daily.
  • Aim for 50 to 500 MB per file and many row groups. Fewer, bigger GETs beat thousands of tiny files, because each file costs a footer read.
  • Select columns, never *, and watch the thread count on previews.
  • Keep the connection across queries so the footer and data stay cached.

Range reads are plain HTTP Range requests, the same mechanism as in range requests from a bucket. If you want to fetch big objects fast outside DuckDB, see parallel byte ranges in Python and Go.

Keep your Parquet files in an S3-compatible bucket with no egress fees and query them in place.

Explore tport.space

Test record and sources

  • Run on 2026-11-14: DuckDB 2.0.0 with httpfs, Python 3.13, rclone 1.76.0 serve s3 behind nginx 1.31 on one Mac, loopback. This is not tport.space itself; request counts depend on DuckDB and the file, not on the server.
  • Each query ran 3 times on a fresh DuckDB connection. Requests and bytes come from the nginx access log (body_bytes_sent per line).
  • The Q5 (LIMIT 10) byte count varied between runs on the default thread count (94,516,677 to 145,241,541 over six runs); the rest were identical every run.
  • DuckDB docs: S3 API support (ENDPOINT, URL_STYLE, USE_SSL, REGION and defaults), Parquet tips (row group size, min/max skipping, sort by the filtered column).