Skip to content

Investigate DuckDB TOP_N + Parquet behavior behind large-sort I/O - #803

Closed
pgarrison with Copilot wants to merge 1 commit into
feature/benchmark-aggregate-parquetfrom
copilot/investigate-parquet-sort-performance
Closed

Investigate DuckDB TOP_N + Parquet behavior behind large-sort I/O#803
pgarrison with Copilot wants to merge 1 commit into
feature/benchmark-aggregate-parquetfrom
copilot/investigate-parquet-sort-performance

Conversation

Copilot AI commented May 18, 2026

Copy link
Copy Markdown
Contributor

Context

Large ORDER BY ... LIMIT queries on 10M–20M parquet rows show multi-GB transfer and minute-scale latency despite DuckDB planning TOP_N. This PR captures root-cause evidence from DuckDB source to explain why row-group pruning is weaker than expected for this query shape.

Changes

  • Planner/engine behavior analysis
    • Confirmed LIMIT + ORDER BY is rewritten to LOGICAL_TOP_N and pushes a scan-side dynamic filter.
    • Confirmed dynamic filter starts uninitialized and only tightens after boundary discovery in PhysicalTopN.
  • Parquet pruning path analysis
    • Verified row-group skip occurs only when stats pruning returns FILTER_ALWAYS_FALSE; otherwise row groups are read.
    • Verified dynamic filter is wrapped in optional filter semantics, reducing early hard-prune behavior.
  • I/O behavior correlation
    • Linked high transfer volume to incremental boundary tightening + broad projection (SELECT *) + optional-filter handling in parquet scan/prefetch paths.
  • Actionable observability
    • Identified SkipRowGroup vs ReadRowGroup operator logging path as the direct way to see exactly which row groups are scanned.
SELECT *
FROM 'mytable.parquet'
ORDER BY "File Size" DESC, "file_row_number" ASC
LIMIT 52;

Testing

Not applicable — no repository code changes were introduced; this PR is an investigation/evidence update.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • production.int.allencell.org
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/biofile-finder/biofile-finder/node_modules/.bin/mocha --exit (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue May 18, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Investigate large parquet sort performance Investigate DuckDB TOP_N + Parquet behavior behind large-sort I/O May 18, 2026
Copilot AI requested a review from pgarrison May 18, 2026 19:52
@pgarrison pgarrison closed this May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate large parquet sort performance

2 participants