Skip to content

perf(physical-optimizer): skip ensure_distribution rebuild when children are unchanged#22521

Open
zhuqi-lucas wants to merge 5 commits into
apache:mainfrom
zhuqi-lucas:qizhu/enforce-distribution-skip-rebuild
Open

perf(physical-optimizer): skip ensure_distribution rebuild when children are unchanged#22521
zhuqi-lucas wants to merge 5 commits into
apache:mainfrom
zhuqi-lucas:qizhu/enforce-distribution-skip-rebuild

Conversation

@zhuqi-lucas
Copy link
Copy Markdown
Contributor

@zhuqi-lucas zhuqi-lucas commented May 26, 2026

Which issue does this PR close?

Rationale for this change

ensure_distribution in datafusion/physical-optimizer/src/ensure_requirements/enforce_distribution.rs unconditionally calls plan.with_new_children(children_plans) after collecting the (possibly redistributed) children, even when none of those children were actually replaced. For nodes like ProjectionExec, that path runs through try_new and recomputes the schema, equivalence properties, output ordering, and output partitioning, then allocates a new Arc<dyn ExecutionPlan>. When every child Arc is pointer-identical to the input, that work produces a logically identical node — pure overhead.

The cost is amplified by two factors:

  1. Plan depth. Workloads dominated by point queries (no join / aggregate / unmet ordering — i.e. nothing for ensure_distribution to inject a RepartitionExec or SortExec for) hit this wasted rebuild at every node in the plan. A 5–30 deep ProjectionExec stack pays the cost N times.
  2. Schema width. Most steps inside ProjectionExec::try_new are O(num_columns): per-column data_type / nullable lookup to build the new schema, per-column remapping of equivalence classes through the projection mapping, and per-column lookup when rewriting PhysicalSortExprs into the output ordering. Wide schemas (tens of columns) make every wasted rebuild proportionally heavier.

Profiling a production point-query workload (wide schemas, deep ProjectionExec stacks) showed ProjectionExec::with_new_children as the single largest cost inside ensure_distribution:

  • ensure_distribution total: 2.87s of a 60s CPU sample
  • ProjectionExec::with_new_children: 1.94s (56% of the rule)
  • SortExec::with_new_children: 0.11s
  • Other ExecutionPlan nodes: 0.82s

What changes are included in this PR?

After collecting children_plans, compare each new child Arc with the original via Arc::ptr_eq. When every child is unchanged, reuse the existing plan Arc and skip with_new_children. The UnionExec to InterleaveExec special case still runs first because it intentionally produces a new node even when child Arcs are unchanged.

This relies on the fact that ensure_distribution already produces pointer-identical Arcs for children that need no redistribution (it threads the original Arc through unchanged), so Arc::ptr_eq precisely distinguishes "rewritten" from "untouched" children at O(1) per child.

Are these changes tested?

Yes. The existing enforce_distribution suite passes unchanged (66/66):

cargo test --release -p datafusion --test core_integration -- physical_optimizer::enforce_distribution

The behavior is observable only as a CPU reduction; correctness is preserved because ExecutionPlan nodes are immutable, so reusing the original Arc produces the same plan tree as with_new_children(unchanged_children) would have, just without the schema / ordering / equivalence / partitioning recomputation.

Are there any user-facing changes?

No. Same plans, lower planning time.

Micro-benchmark

Plan shape: 30-deep ProjectionExec stack over a sorted parquet scan, 5000 iterations.

  • Without fix: 852.74 ms total, 170.55 us/call
  • With fix: 296.81 ms total, 59.36 us/call
  • ~2.87x speedup, -65% CPU per call

Wider schemas (more projection expressions per node) widen the gap further because each skipped with_new_children avoids more O(num_columns) work.

…ren are unchanged

ensure_distribution was unconditionally calling plan.with_new_children after collecting the (possibly redistributed) children, even when none of the children were actually replaced. For nodes like ProjectionExec, that path runs through try_new and recomputes the schema, equivalence properties, and output ordering each time, which is pure overhead when the input Arcs are identical.

Compare each new child Arc with the original via Arc::ptr_eq and reuse the existing plan Arc when nothing changed. The UnionExec to InterleaveExec special case still runs first because it intentionally produces a new node.

On a representative deep ProjectionExec stack (30 layers over a sorted parquet scan, no join / aggregate / unmet ordering, 5000 iterations) this brings ensure_distribution from 170.55 us/call to 59.36 us/call, a ~2.87x speedup. Profiling on a real workload dominated by point queries showed ProjectionExec::with_new_children taking 1.94s out of a 2.87s ensure_distribution slice in a 60s sample, so this is the bulk of the rule's cost on that shape.

Closes apache#22520
Copilot AI review requested due to automatic review settings May 26, 2026 06:34
@github-actions github-actions Bot added the optimizer Optimizer rules label May 26, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes the physical optimizer’s distribution enforcement by avoiding unnecessary plan-node rebuilds when the computed child plans are identical to the existing children, reducing planning CPU overhead (notably for deep ProjectionExec stacks) without changing correctness.

Changes:

  • Detect when all post-processing child plan Arcs are pointer-identical to the original children via Arc::ptr_eq.
  • Reuse the existing plan Arc and skip with_new_children when children are unchanged.
  • Preserve the existing UnionExecInterleaveExec special-case behavior by applying it before the “children unchanged” fast-path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zhuqi-lucas zhuqi-lucas requested review from 2010YOUY01 and alamb May 27, 2026 02:44
Copy link
Copy Markdown
Contributor

@2010YOUY01 2010YOUY01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!

It seems we have already tried to solve a similar issue before: https://github.com/apache/datafusion/pull/19792/changes#diff-8ea78154af964a28c15386d17e3e6ce2f056651666a94dc7c5fb9f66dd849588R325 it avoids to recompute PlanProperties, but it seems there are still remaining wasteful computation exists.

I think we should better to keep the logic in the same place. Now this PR handles it at the caller side, and #19792 is avoiding re-computation at the callee side.
I prefer this PR's approach, I think keeping the check at the caller side is easier to maintain. However this might require some large changes, if that's the case we could do that as a follow-up PR/

// `ensure_distribution` time for plans where no distribution change
// applies (point queries with no join / aggregate / unmet ordering),
// so the rebuild is wasted on the common case.
let original_children = plan.children();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could introduce a helper like
with_new_children_if_necessary(plan, children_plans), and later disallow direct with_new_children() usage via clippy. This way we could enforce the helper project-wide to avoid similar issues.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion @2010YOUY01 , addressed in latest PR.

Asserts that when no child of a node is replaced (no RepartitionExec /
SortExec injection required), ensure_distribution reuses the input
Arc<dyn ExecutionPlan> via Arc::ptr_eq instead of going through
with_new_children. Guards the fast path against a future refactor
re-introducing the unconditional rebuild.
Per reviewer suggestion in apache#22521, replace the inline Arc::ptr_eq +
with_new_children branch with a call to the existing
datafusion_physical_plan::with_new_children_if_necessary helper.

Same behavior, smaller surface area, keeps the optimization in one
canonical place so future call sites elsewhere in the optimizer pick
it up automatically.
@github-actions github-actions Bot added the core Core DataFusion crate label May 27, 2026
@zhuqi-lucas
Copy link
Copy Markdown
Contributor Author

zhuqi-lucas commented May 27, 2026

Thanks for the review @2010YOUY01! Good catch on #19792 — I had not noticed that one.

I just pushed two updates:

  1. Switched to the existing with_new_children_if_necessary helper (datafusion_physical_plan::with_new_children_if_necessary). Same behavior, fewer lines, keeps the optimization in one canonical place.
  2. Added a regression test (ensure_distribution_reuses_plan_arc_when_no_redistribution_needed) that asserts Arc::ptr_eq(result, input) on a deep ProjectionExec chain over a single-partition scan — guards the fast path against future refactors.

Re: the clippy lint to disallow direct with_new_children() usage project-wide — happy to take that as a follow-up PR. As you note it's a much larger change since every existing call site would need to switch to the helper, and I'd want to do it separately so this PR stays focused on the distribution rule.

Latest commits: 28a92a5 (refactor) + b5beced (test).

Also created the follow-up #22555

Copy link
Copy Markdown
Contributor

@2010YOUY01 2010YOUY01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me -- thanks @zhuqi-lucas and @2010YOUY01

@alamb alamb added the performance Make DataFusion faster label May 27, 2026
@alamb
Copy link
Copy Markdown
Contributor

alamb commented May 27, 2026

run benchmark sql_planner

@adriangbot
Copy link
Copy Markdown

🤖 Criterion benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4557272268-342-ngls7 6.12.68+ #1 SMP Wed Apr 1 02:23:28 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing qizhu/enforce-distribution-skip-rebuild (46cec88) to d3983d3 (merge-base) diff
BENCH_NAME=sql_planner
BENCH_COMMAND=cargo bench --features=parquet --bench sql_planner
BENCH_FILTER=
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot
Copy link
Copy Markdown

🤖 Criterion benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

group                                                 main                                    qizhu_enforce-distribution-skip-rebuild
-----                                                 ----                                    ---------------------------------------
logical_aggregate_with_join                           1.01    456.6±1.83µs        ? ?/sec     1.00    450.0±1.47µs        ? ?/sec
logical_correlated_subquery_exists                    1.00    285.1±1.34µs        ? ?/sec     1.00    284.3±0.79µs        ? ?/sec
logical_correlated_subquery_in                        1.01    285.6±1.33µs        ? ?/sec     1.00    283.4±1.00µs        ? ?/sec
logical_distinct_many_columns                         1.02    579.6±2.16µs        ? ?/sec     1.00    568.5±1.79µs        ? ?/sec
logical_join_4_with_agg_and_filter                    1.01    248.8±0.84µs        ? ?/sec     1.00    247.4±2.27µs        ? ?/sec
logical_join_8_with_agg_sort_limit                    1.01    422.8±2.57µs        ? ?/sec     1.00    420.0±2.13µs        ? ?/sec
logical_join_chain_16                                 1.00    674.6±2.92µs        ? ?/sec     1.01    678.6±2.94µs        ? ?/sec
logical_join_chain_4                                  1.02    122.8±0.82µs        ? ?/sec     1.00    120.7±0.43µs        ? ?/sec
logical_join_chain_8                                  1.01    251.7±0.88µs        ? ?/sec     1.00    249.1±0.70µs        ? ?/sec
logical_multiple_subqueries                           1.00    512.4±2.13µs        ? ?/sec     1.00    514.2±1.26µs        ? ?/sec
logical_nested_cte_4_levels                           1.00    271.0±1.40µs        ? ?/sec     1.00    270.7±1.34µs        ? ?/sec
logical_plan_struct_join_agg_sort                     1.05    183.0±1.70µs        ? ?/sec     1.00    173.8±1.14µs        ? ?/sec
logical_plan_tpcds_all                                1.00     85.6±0.14ms        ? ?/sec     1.00     86.0±0.86ms        ? ?/sec
logical_plan_tpch_all                                 1.01      6.3±0.07ms        ? ?/sec     1.00      6.3±0.06ms        ? ?/sec
logical_scalar_subquery                               1.01    308.7±1.39µs        ? ?/sec     1.00    307.0±1.71µs        ? ?/sec
logical_select_all_from_1000                          1.02    106.2±1.56ms        ? ?/sec     1.00    104.5±0.23ms        ? ?/sec
logical_select_one_from_700                           1.01    329.6±1.88µs        ? ?/sec     1.00    326.8±2.11µs        ? ?/sec
logical_trivial_join_high_numbered_columns            1.01    288.6±1.20µs        ? ?/sec     1.00    284.9±0.97µs        ? ?/sec
logical_trivial_join_low_numbered_columns             1.01    274.9±1.15µs        ? ?/sec     1.00    273.3±0.93µs        ? ?/sec
logical_union_4_branches                              1.00    424.5±1.79µs        ? ?/sec     1.00    424.3±2.11µs        ? ?/sec
logical_union_8_branches                              1.00    814.6±3.68µs        ? ?/sec     1.01    821.8±6.92µs        ? ?/sec
logical_wide_aggregate_100_exprs                      1.00      4.3±0.02ms        ? ?/sec     1.00      4.3±0.05ms        ? ?/sec
logical_wide_case_50_exprs                            1.00      2.4±0.00ms        ? ?/sec     1.01      2.4±0.01ms        ? ?/sec
logical_wide_filter_200_predicates                    1.00  1310.1±14.63µs        ? ?/sec     1.00  1312.3±11.57µs        ? ?/sec
logical_wide_filter_50_predicates                     1.01    393.2±3.28µs        ? ?/sec     1.00    389.3±3.38µs        ? ?/sec
optimizer_correlated_exists                           1.02    255.8±1.46µs        ? ?/sec     1.00    251.6±1.38µs        ? ?/sec
optimizer_join_4_with_agg_filter                      1.02    432.7±2.59µs        ? ?/sec     1.00    422.7±2.42µs        ? ?/sec
optimizer_join_chain_4                                1.00    175.7±0.67µs        ? ?/sec     1.00    175.4±0.87µs        ? ?/sec
optimizer_join_chain_8                                1.00    552.6±1.84µs        ? ?/sec     1.00    549.9±2.66µs        ? ?/sec
optimizer_select_all_from_1000                        1.01      4.6±0.03ms        ? ?/sec     1.00      4.6±0.01ms        ? ?/sec
optimizer_select_one_from_700                         1.01    261.2±1.14µs        ? ?/sec     1.00    259.1±0.74µs        ? ?/sec
optimizer_tpcds_all                                   1.01    252.5±2.47ms        ? ?/sec     1.00    250.9±2.33ms        ? ?/sec
optimizer_tpch_all                                    1.00     14.4±0.24ms        ? ?/sec     1.00     14.4±0.22ms        ? ?/sec
optimizer_wide_aggregate_100                          1.00      2.1±0.01ms        ? ?/sec     1.00      2.1±0.01ms        ? ?/sec
optimizer_wide_filter_200                             1.00      3.4±0.01ms        ? ?/sec     1.00      3.4±0.01ms        ? ?/sec
physical_intersection                                 1.01    580.1±1.44µs        ? ?/sec     1.00    575.7±1.95µs        ? ?/sec
physical_join_consider_sort                           1.02  1026.3±12.24µs        ? ?/sec     1.00   1006.1±7.68µs        ? ?/sec
physical_join_distinct                                1.01    269.5±1.36µs        ? ?/sec     1.00    266.2±1.60µs        ? ?/sec
physical_many_self_joins                              1.01      7.7±0.08ms        ? ?/sec     1.00      7.6±0.01ms        ? ?/sec
physical_plan_clickbench_all                          1.00    124.1±5.82ms        ? ?/sec     1.00    123.6±6.22ms        ? ?/sec
physical_plan_clickbench_q1                           1.00  1322.5±49.84µs        ? ?/sec     1.00  1327.5±54.80µs        ? ?/sec
physical_plan_clickbench_q10                          1.00  1969.0±121.70µs        ? ?/sec    1.00  1960.7±112.86µs        ? ?/sec
physical_plan_clickbench_q11                          1.00      2.2±0.19ms        ? ?/sec     1.00      2.2±0.18ms        ? ?/sec
physical_plan_clickbench_q12                          1.00      2.2±0.02ms        ? ?/sec     1.01      2.2±0.01ms        ? ?/sec
physical_plan_clickbench_q13                          1.01      2.1±0.12ms        ? ?/sec     1.00      2.0±0.11ms        ? ?/sec
physical_plan_clickbench_q14                          1.00      2.1±0.10ms        ? ?/sec     1.02      2.2±0.12ms        ? ?/sec
physical_plan_clickbench_q15                          1.03      2.1±0.18ms        ? ?/sec     1.00      2.0±0.12ms        ? ?/sec
physical_plan_clickbench_q16                          1.00  1657.4±18.85µs        ? ?/sec     1.01  1679.3±84.05µs        ? ?/sec
physical_plan_clickbench_q17                          1.00   1700.2±9.20µs        ? ?/sec     1.00   1694.0±6.80µs        ? ?/sec
physical_plan_clickbench_q18                          1.00  1629.9±53.52µs        ? ?/sec     1.01  1648.7±53.63µs        ? ?/sec
physical_plan_clickbench_q19                          1.00  1992.2±112.86µs        ? ?/sec    1.00  1994.8±96.41µs        ? ?/sec
physical_plan_clickbench_q2                           1.01   1695.6±5.85µs        ? ?/sec     1.00   1682.5±7.29µs        ? ?/sec
physical_plan_clickbench_q20                          1.00  1491.6±54.49µs        ? ?/sec     1.00  1486.4±59.98µs        ? ?/sec
physical_plan_clickbench_q21                          1.00  1702.1±83.67µs        ? ?/sec     1.00  1701.8±85.91µs        ? ?/sec
physical_plan_clickbench_q22                          1.00      2.0±0.01ms        ? ?/sec     1.00      2.0±0.01ms        ? ?/sec
physical_plan_clickbench_q23                          1.00      2.2±0.07ms        ? ?/sec     1.09      2.4±0.14ms        ? ?/sec
physical_plan_clickbench_q24                          1.02      6.9±0.28ms        ? ?/sec     1.00      6.7±0.27ms        ? ?/sec
physical_plan_clickbench_q25                          1.01  1819.7±16.54µs        ? ?/sec     1.00   1804.1±6.56µs        ? ?/sec
physical_plan_clickbench_q26                          1.00  1671.0±39.60µs        ? ?/sec     1.00  1663.0±41.10µs        ? ?/sec
physical_plan_clickbench_q27                          1.06  1931.1±159.56µs        ? ?/sec    1.00  1823.4±25.81µs        ? ?/sec
physical_plan_clickbench_q28                          1.02      2.4±0.16ms        ? ?/sec     1.00      2.3±0.16ms        ? ?/sec
physical_plan_clickbench_q29                          1.00      2.4±0.01ms        ? ?/sec     1.05      2.5±0.23ms        ? ?/sec
physical_plan_clickbench_q3                           1.00  1631.3±55.53µs        ? ?/sec     1.00  1638.7±43.64µs        ? ?/sec
physical_plan_clickbench_q30                          1.01     15.2±0.27ms        ? ?/sec     1.00     15.0±0.08ms        ? ?/sec
physical_plan_clickbench_q31                          1.03      2.5±0.20ms        ? ?/sec     1.00      2.5±0.18ms        ? ?/sec
physical_plan_clickbench_q32                          1.00      2.5±0.22ms        ? ?/sec     1.00      2.5±0.22ms        ? ?/sec
physical_plan_clickbench_q33                          1.00   1889.1±5.85µs        ? ?/sec     1.00   1895.7±7.19µs        ? ?/sec
physical_plan_clickbench_q34                          1.00  1741.3±75.60µs        ? ?/sec     1.02  1770.7±68.98µs        ? ?/sec
physical_plan_clickbench_q35                          1.06  1871.8±128.63µs        ? ?/sec    1.00  1767.4±57.30µs        ? ?/sec
physical_plan_clickbench_q36                          1.00      2.2±0.17ms        ? ?/sec     1.00      2.2±0.17ms        ? ?/sec
physical_plan_clickbench_q37                          1.00      2.5±0.21ms        ? ?/sec     1.00      2.5±0.21ms        ? ?/sec
physical_plan_clickbench_q38                          1.01      2.4±0.01ms        ? ?/sec     1.00      2.4±0.01ms        ? ?/sec
physical_plan_clickbench_q39                          1.00      2.5±0.15ms        ? ?/sec     1.12      2.8±0.08ms        ? ?/sec
physical_plan_clickbench_q4                           1.00   1378.6±5.61µs        ? ?/sec     1.02  1406.2±36.41µs        ? ?/sec
physical_plan_clickbench_q40                          1.00      3.3±0.18ms        ? ?/sec     1.02      3.4±0.26ms        ? ?/sec
physical_plan_clickbench_q41                          1.04      2.8±0.17ms        ? ?/sec     1.00      2.7±0.03ms        ? ?/sec
physical_plan_clickbench_q42                          1.00      3.1±0.24ms        ? ?/sec     1.01      3.2±0.23ms        ? ?/sec
physical_plan_clickbench_q43                          1.00      3.0±0.01ms        ? ?/sec     1.00      3.0±0.01ms        ? ?/sec
physical_plan_clickbench_q44                          1.00   1484.3±5.24µs        ? ?/sec     1.00  1484.3±23.24µs        ? ?/sec
physical_plan_clickbench_q45                          1.01  1510.9±35.73µs        ? ?/sec     1.00  1499.1±29.77µs        ? ?/sec
physical_plan_clickbench_q46                          1.00  1830.0±87.42µs        ? ?/sec     1.01  1841.8±91.44µs        ? ?/sec
physical_plan_clickbench_q47                          1.00      2.5±0.01ms        ? ?/sec     1.00      2.5±0.01ms        ? ?/sec
physical_plan_clickbench_q48                          1.00      2.7±0.11ms        ? ?/sec     1.02      2.8±0.13ms        ? ?/sec
physical_plan_clickbench_q49                          1.05      2.9±0.24ms        ? ?/sec     1.00      2.7±0.06ms        ? ?/sec
physical_plan_clickbench_q5                           1.01  1561.3±75.96µs        ? ?/sec     1.00  1542.6±71.05µs        ? ?/sec
physical_plan_clickbench_q50                          1.00      2.5±0.01ms        ? ?/sec     1.00      2.5±0.01ms        ? ?/sec
physical_plan_clickbench_q51                          1.00  1954.5±94.95µs        ? ?/sec     1.01  1979.4±95.91µs        ? ?/sec
physical_plan_clickbench_q6                           1.01  1540.5±63.52µs        ? ?/sec     1.00  1531.3±61.57µs        ? ?/sec
physical_plan_clickbench_q7                           1.00   1344.2±5.69µs        ? ?/sec     1.02   1366.2±6.40µs        ? ?/sec
physical_plan_clickbench_q8                           1.00  1929.7±102.52µs        ? ?/sec    1.03  1994.0±103.87µs        ? ?/sec
physical_plan_clickbench_q9                           1.00  1803.3±27.39µs        ? ?/sec     1.01  1813.6±30.91µs        ? ?/sec
physical_plan_struct_join_agg_sort                    1.03   1258.1±2.39µs        ? ?/sec     1.00   1221.3±2.38µs        ? ?/sec
physical_plan_tpcds_all                               1.01   675.1±16.44ms        ? ?/sec     1.00   668.1±16.60ms        ? ?/sec
physical_plan_tpch_all                                1.01     44.1±1.08ms        ? ?/sec     1.00     43.8±1.10ms        ? ?/sec
physical_plan_tpch_q1                                 1.03   1463.4±3.15µs        ? ?/sec     1.00   1427.0±4.37µs        ? ?/sec
physical_plan_tpch_q10                                1.00      2.7±0.00ms        ? ?/sec     1.01      2.8±0.07ms        ? ?/sec
physical_plan_tpch_q11                                1.03      2.1±0.04ms        ? ?/sec     1.00      2.1±0.01ms        ? ?/sec
physical_plan_tpch_q12                                1.02   1149.0±6.62µs        ? ?/sec     1.00   1130.6±4.13µs        ? ?/sec
physical_plan_tpch_q13                                1.01    903.0±4.11µs        ? ?/sec     1.00    892.0±4.54µs        ? ?/sec
physical_plan_tpch_q14                                1.00  1355.9±16.47µs        ? ?/sec     1.00  1350.0±20.18µs        ? ?/sec
physical_plan_tpch_q16                                1.02   1496.3±9.14µs        ? ?/sec     1.00   1460.1±2.02µs        ? ?/sec
physical_plan_tpch_q17                                1.02  1668.1±20.03µs        ? ?/sec     1.00  1638.3±20.30µs        ? ?/sec
physical_plan_tpch_q18                                1.01  1767.8±32.80µs        ? ?/sec     1.00  1744.4±18.64µs        ? ?/sec
physical_plan_tpch_q19                                1.01  1611.6±25.39µs        ? ?/sec     1.00  1597.4±23.23µs        ? ?/sec
physical_plan_tpch_q2                                 1.01      4.0±0.09ms        ? ?/sec     1.00      4.0±0.10ms        ? ?/sec
physical_plan_tpch_q20                                1.02      2.2±0.09ms        ? ?/sec     1.00      2.2±0.09ms        ? ?/sec
physical_plan_tpch_q21                                1.01      2.9±0.00ms        ? ?/sec     1.00      2.9±0.00ms        ? ?/sec
physical_plan_tpch_q22                                1.00  1533.2±20.77µs        ? ?/sec     1.00  1534.5±20.94µs        ? ?/sec
physical_plan_tpch_q3                                 1.02  1848.7±39.33µs        ? ?/sec     1.00  1806.1±34.07µs        ? ?/sec
physical_plan_tpch_q4                                 1.02   1164.5±3.01µs        ? ?/sec     1.00   1146.7±2.02µs        ? ?/sec
physical_plan_tpch_q5                                 1.01      2.5±0.06ms        ? ?/sec     1.00      2.5±0.07ms        ? ?/sec
physical_plan_tpch_q6                                 1.02    609.1±1.95µs        ? ?/sec     1.00    594.9±2.91µs        ? ?/sec
physical_plan_tpch_q7                                 1.00      3.1±0.13ms        ? ?/sec     1.00      3.0±0.13ms        ? ?/sec
physical_plan_tpch_q8                                 1.01      3.9±0.00ms        ? ?/sec     1.00      3.8±0.00ms        ? ?/sec
physical_plan_tpch_q9                                 1.01      2.7±0.00ms        ? ?/sec     1.00      2.7±0.00ms        ? ?/sec
physical_select_aggregates_from_200                   1.00     15.5±0.11ms        ? ?/sec     1.00     15.5±0.13ms        ? ?/sec
physical_select_all_from_1000                         1.00    113.2±0.19ms        ? ?/sec     1.00    113.6±0.60ms        ? ?/sec
physical_select_one_from_700                          1.01    776.5±2.98µs        ? ?/sec     1.00    767.9±2.19µs        ? ?/sec
physical_sorted_union_order_by_10_int64               1.01      4.5±0.09ms        ? ?/sec     1.00      4.4±0.08ms        ? ?/sec
physical_sorted_union_order_by_10_uint64              1.01      8.5±0.17ms        ? ?/sec     1.00      8.4±0.17ms        ? ?/sec
physical_sorted_union_order_by_50_int64               1.00    108.8±1.72ms        ? ?/sec     1.00    108.9±1.96ms        ? ?/sec
physical_sorted_union_order_by_50_uint64              1.01    362.0±7.52ms        ? ?/sec     1.00    359.2±6.73ms        ? ?/sec
physical_theta_join_consider_sort                     1.02   1039.8±7.51µs        ? ?/sec     1.00   1023.4±2.73µs        ? ?/sec
physical_unnest_to_join                               1.02    656.5±2.22µs        ? ?/sec     1.00    646.3±3.52µs        ? ?/sec
physical_window_function_partition_by_12_on_values    1.03    712.4±5.60µs        ? ?/sec     1.00    694.3±2.28µs        ? ?/sec
physical_window_function_partition_by_30_on_values    1.01  1435.1±13.22µs        ? ?/sec     1.00  1420.1±12.51µs        ? ?/sec
physical_window_function_partition_by_4_on_values     1.04    430.1±1.67µs        ? ?/sec     1.00    412.3±2.49µs        ? ?/sec
physical_window_function_partition_by_7_on_values     1.04    535.2±1.36µs        ? ?/sec     1.00    514.3±1.50µs        ? ?/sec
physical_window_function_partition_by_8_on_values     1.04    575.7±5.31µs        ? ?/sec     1.00    555.1±2.32µs        ? ?/sec
with_param_values_many_columns                        1.00    431.1±2.23µs        ? ?/sec     1.01    433.4±2.64µs        ? ?/sec

Resource Usage

base (merge-base)

Metric Value
Wall time 1560.3s
Peak memory 19.9 GiB
Avg memory 19.8 GiB
CPU user 1874.6s
CPU sys 1.8s
Peak spill 0 B

branch

Metric Value
Wall time 1565.3s
Peak memory 19.9 GiB
Avg memory 19.9 GiB
CPU user 1876.0s
CPU sys 1.5s
Peak spill 0 B

File an issue against this benchmark runner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate optimizer Optimizer rules performance Make DataFusion faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: ensure_distribution rebuilds plan nodes unnecessarily when children are unchanged

5 participants