Skip to content

feat: display query-wide metric totals in plan dumps - #904

Merged
gabotechs merged 2 commits into
mainfrom
plan-dump-totals
Nov 19, 2026
Merged

gabotechs merged 2 commits into
mainfrom
plan-dump-totals

Conversation

@gabotechs

@gabotechs gabotechs commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Answering "how much CPU did this whole query burn?" or "how many rows did all its operators produce?" from a plan dump currently means reading every node of every stage and adding up its metrics by hand, and each metric has to be combined its own way (summed, max'd, etc.).

This adds a totals view to display_plan_dump (dfd plan -t): instead of rendering the plan, it adds up the metrics reported by every node of the query by name, using each metric's own aggregate. The metrics derived for displaying stages, like a stage's elapsed_compute, are left out, as they're computed from the nodes' own and would count them twice.

 dfd plan --stage 1 dump                      dfd plan -t dump

 Stage 2                                      Totals
 └─ AggregateExec       elapsed=10ms            elapsed_compute = 2 + 10 + 30 + 80 ms
    └─ NetworkShuffle   elapsed=2ms             output_rows     = Σ every node
 Stage 1                                        ...
 └─ RepartitionExec     elapsed=30ms
    └─ DataSourceExec   elapsed=80ms

The existing filters compose with it: --stage N only adds up the nodes of that stage, and -m only shows the totals of the matching metrics. Totals are always shown aggregated across tasks, since task ids of different stages are unrelated.

@gabotechs
gabotechs marked this pull request as ready for review November 19, 2026 19:59
@gabotechs
gabotechs merged commit 848dd57 into main Nov 19, 2026
38 checks passed
@gabotechs
gabotechs deleted the plan-dump-totals branch November 19, 2026 19:59
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.

1 participant