Skip to content

perf: reuse projection schema in OptimizeProjections instead of recomputing it - #24281

Draft
zhuqi-lucas wants to merge 4 commits into
apache:mainfrom
zhuqi-lucas:optimize-projections-reuse-schema
Draft

perf: reuse projection schema in OptimizeProjections instead of recomputing it#24281
zhuqi-lucas wants to merge 4 commits into
apache:mainfrom
zhuqi-lucas:optimize-projections-reuse-schema

Conversation

@zhuqi-lucas

@zhuqi-lucas zhuqi-lucas commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Which issue does this close?

Closes #24264. Answers #24284 in the process.

Rationale for this change

rewrite_projection_given_requirements, the core of OptimizeProjections, prunes a projection's expressions to the subset actually required and then rebuilds it with Projection::try_new. try_new recomputes the output schema via projection_schema, calling Expr::to_field for every retained expression; column resolution is a linear scan over the input schema, so this is O(exprs * schema_width) per projection, per pass. The retained expressions are a subset of the ones the projection already has, so the answer is already sitting in proj.schema.

Reusing it turned out not to be safe as-is, which is what the first revision of this PR got wrong and what #24284 is about.

LogicalPlan::map_expressions replaces a projection's expressions while keeping its existing schema, so SimplifyExpressions can leave the two out of step. Constant folding turns arrow_cast([...], 'LargeList(...)'), a function call whose field the planner derived as nullable, into a non-null literal whose field is not, while the schema keeps the pre-folding answer. OptimizeProjections calling try_new was quietly normalising that back, so whether a stale schema survived into the final plan depended on which rules happened to fire.

So this PR fixes that first, then does the optimisation.

What changes are included in this PR?

1. SimplifyExpressions derives the projection schema after rewriting (simplify_exprs.rs), and only when the expressions actually changed.

Final plans are unchanged: the normalisation OptimizeProjections was performing simply happens earlier now. Nothing in the tree needed updating, no snapshot and no expected plan, which is the clearest evidence this is an equivalence rather than a behaviour change.

2. rewrite_projection_given_requirements derives the pruned schema by selecting the already-computed fields from the existing projection schema (project_schema_by_indices) and builds with Projection::try_new_with_schema. When nothing is pruned, the existing Arc is reused as-is. Functional dependencies are projected through the kept indices.

Cost goes from O(exprs * width) to O(k), and to O(1) when nothing is pruned. Unlike making the recompute cheaper, this removes the work rather than speeding it up: no to_field call, no field allocation, no cache and no heuristics.

Correctness

With (1) in place, proj.schema is in step with proj.expr, so slicing it at the retained indices produces exactly what projection_schema would recompute: field i corresponds to expression i, and RequiredIndices yields a sorted, deduplicated subset.

project_schema_by_indices_matches_recompute asserts that, for a mixed expression list (plain column, computed binary expr, alias, NULL literal, qualified column) and every representative index subset, the sliced schema matches projection_schema on fields, qualifiers, schema metadata and functional dependencies, and that the identity subset reuses the same Arc.

The two failures the first revision of this PR introduced are fixed by (1), not worked around:

  • roundtrip_literal_list, roundtrip_literal_struct, roundtrip_literal_named_struct, roundtrip_literal_renamed_struct in datafusion-substrait, which compare plan schemas across a roundtrip
  • schema_evolution_nested.slt, where the projection feeds COPY (SELECT ...) TO ... STORED AS PARQUET, so a stale nullability reached the written file and DESCRIBE reported YES instead of NO

Full local runs: datafusion-substrait 49 + 200 + 3, datafusion-optimizer 760 + 26 + 5, datafusion-expr 248 + 55, datafusion-common 547, datafusion-sql 88 + 572 + 12, and schema_evolution_nested.slt 1/1. All green, with no test or snapshot modified.

Are there any user-facing changes?

No. Optimized plans are unchanged.

Copilot AI lite review requested due to automatic review settings August 12, 2026 07:51
@github-actions github-actions Bot added the optimizer Optimizer rules label Aug 12, 2026

Copilot AI left a comment

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.

Pull request overview

Improves OptimizeProjections performance by avoiding repeated recomputation of projection output schemas when pruning projection expressions, instead reusing/slicing the already-computed Projection.schema.

Changes:

  • Update rewrite_projection_given_requirements to build pruned projections via Projection::try_new_with_schema using a sliced schema from the existing projection schema.
  • Add project_schema_by_indices helper to project fields + functional dependencies while reusing schema metadata.
  • Add a unit test validating that sliced schemas match projection_schema recomputation across representative index subsets.
Suppressed comments (1)

datafusion/optimizer/src/optimize_projections/mod.rs:1285

  • project_schema_by_indices also projects functional dependencies and preserves schema-level metadata, but the test currently only compares fields and qualifiers. Adding assertions for functional dependencies and schema metadata will better protect the behavior this PR relies on.
            // Output fields (name, data type, nullability, field metadata) must
            // match the from-scratch computation exactly.
            assert_eq!(
                reused.fields(),
                recomputed.fields(),
                "fields differ for indices {indices:?}"
            );

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1249 to +1252
binary_expr(col("b"), Operator::Plus, col("c")),
col("c").alias("c_alias"),
lit(1_i64).alias("one"),
Expr::Column(Column::new(Some(TableReference::bare("test")), "b")),
…puting it

`rewrite_projection_given_requirements` rebuilt the pruned projection with
`Projection::try_new`, which recomputes the output schema from scratch via
`projection_schema`: it calls `Expr::to_field` for every retained expression,
and column resolution (`DFSchema::field_from_column`) is a linear scan, so
recomputing a projection's schema is O(exprs * schema_width) and runs on every
projection on every optimizer pass. This is especially costly for wide
`SELECT *`-style projections over wide schemas.

The retained expressions are a subset of the projection's original expressions,
so their output fields are unchanged by pruning unreferenced sibling columns.
Select those fields from the existing projection schema and construct the pruned
projection with `try_new_with_schema`, mirroring the schema reuse already done
in `merge_consecutive_projections`. When nothing is pruned the schema Arc is
reused as-is. This turns the per-projection schema cost from O(exprs * width)
into O(k).

Behavior-preserving: the sliced schema is identical to the recomputed one. Adds
`project_schema_by_indices_matches_recompute` asserting that equivalence across
expression subsets; the full datafusion-optimizer suite still passes.
Addresses review feedback on the schema-reuse test:

- The comment claimed a nullable literal, but lit(1_i64) is non-nullable,
  so nullability propagation was never actually exercised. Swapped it for a
  NULL Int64 literal and added assertions pinning the premise that the
  literal is nullable while the input columns are not.
- project_schema_by_indices also carries schema-level metadata and projects
  functional dependencies through the kept indices, but the test only
  compared fields and qualifiers. Both are now asserted against the
  from-scratch computation for every subset.
`LogicalPlan::map_expressions` replaces a projection's expressions while
keeping its existing schema, so `SimplifyExpressions` could leave the two
out of step: constant folding turns a function call, whose field the
planner derived as nullable, into a non-null literal, whose field is not,
and the schema keeps the pre-folding answer.

That was invisible because `OptimizeProjections` rebuilds the projections
it touches with `Projection::try_new`, deriving the schema again and
normalising it back. Which meant whether a stale schema reached the final
plan depended on which rules happened to fire, and it blocked deriving a
pruned projection's schema by reuse rather than recomputation.

Derive the schema here instead, only when the expressions actually
changed. The final plans are unchanged, since the normalisation that
`OptimizeProjections` was doing simply happens earlier now: no snapshot
or expected plan in the tree needed updating.
@zhuqi-lucas
zhuqi-lucas marked this pull request as ready for review August 13, 2026 07:12
@codecov-commenter

codecov-commenter commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.62500% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.13%. Comparing base (186f96f) to head (75deafe).

Files with missing lines Patch % Lines
...tafusion/optimizer/src/optimize_projections/mod.rs 90.00% 0 Missing and 8 partials ⚠️
...timizer/src/simplify_expressions/simplify_exprs.rs 93.75% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #24281   +/-   ##
=======================================
  Coverage   81.13%   81.13%           
=======================================
  Files        1112     1112           
  Lines      386716   386802   +86     
  Branches   386716   386802   +86     
=======================================
+ Hits       313765   313839   +74     
- Misses      54479    54481    +2     
- Partials    18472    18482   +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zhuqi-lucas

Copy link
Copy Markdown
Contributor Author

run benchmark sql_planner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c5277634733-1581-7t54h 6.12.85+ #1 SMP Wed Jun 17 20:31:55 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 optimize-projections-reuse-schema (75deafe) to 186f96f (merge-base) diff

Run configuration
run benchmark sql_planner

Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

Comparing optimize-projections-reuse-schema (75deafe) to 186f96f (merge-base) diff

Run configuration
run benchmark sql_planner
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                                                 HEAD                                   optimize-projections-reuse-schema
-----                                                 ----                                   ---------------------------------
logical_aggregate_with_join                           1.02   461.3±12.54µs        ? ?/sec    1.00    453.2±1.53µs        ? ?/sec
logical_correlated_subquery_exists                    1.00    288.3±6.16µs        ? ?/sec    1.00    286.9±0.78µs        ? ?/sec
logical_correlated_subquery_in                        1.00    291.1±6.15µs        ? ?/sec    1.00    289.7±0.85µs        ? ?/sec
logical_distinct_many_columns                         1.00    572.0±1.11µs        ? ?/sec    1.00    570.3±1.23µs        ? ?/sec
logical_join_4_with_agg_and_filter                    1.03    258.9±1.59µs        ? ?/sec    1.00    250.3±0.97µs        ? ?/sec
logical_join_8_with_agg_sort_limit                    1.02    433.1±2.60µs        ? ?/sec    1.00    422.7±1.64µs        ? ?/sec
logical_join_chain_16                                 1.01    682.5±5.79µs        ? ?/sec    1.00    674.9±4.46µs        ? ?/sec
logical_join_chain_4                                  1.02    125.6±0.96µs        ? ?/sec    1.00    123.3±0.60µs        ? ?/sec
logical_join_chain_8                                  1.02    254.4±2.37µs        ? ?/sec    1.00    249.6±0.83µs        ? ?/sec
logical_multiple_subqueries                           1.01    523.0±6.61µs        ? ?/sec    1.00    520.2±2.09µs        ? ?/sec
logical_nested_cte_4_levels                           1.02    266.9±1.17µs        ? ?/sec    1.00    260.8±1.15µs        ? ?/sec
logical_plan_struct_join_agg_sort                     1.04    183.8±5.17µs        ? ?/sec    1.00    176.7±1.11µs        ? ?/sec
logical_plan_tpcds_all                                1.01     94.7±0.23ms        ? ?/sec    1.00     93.6±0.57ms        ? ?/sec
logical_plan_tpch_all                                 1.03      6.7±0.03ms        ? ?/sec    1.00      6.5±0.07ms        ? ?/sec
logical_scalar_subquery                               1.00    312.1±6.60µs        ? ?/sec    1.00    312.2±1.26µs        ? ?/sec
logical_select_all_from_1000                          1.00    103.7±0.37ms        ? ?/sec    1.00    104.1±0.19ms        ? ?/sec
logical_select_one_from_700                           1.02   333.2±15.89µs        ? ?/sec    1.00    325.9±1.53µs        ? ?/sec
logical_trivial_join_high_numbered_columns            1.02   291.4±12.30µs        ? ?/sec    1.00    285.7±0.69µs        ? ?/sec
logical_trivial_join_low_numbered_columns             1.02   279.8±12.16µs        ? ?/sec    1.00    273.3±0.82µs        ? ?/sec
logical_union_4_branches                              1.01    430.2±1.55µs        ? ?/sec    1.00    426.1±1.29µs        ? ?/sec
logical_union_8_branches                              1.01    817.1±2.59µs        ? ?/sec    1.00    809.5±1.62µs        ? ?/sec
logical_wide_aggregate_100_exprs                      1.00      4.5±0.02ms        ? ?/sec    1.00      4.5±0.02ms        ? ?/sec
logical_wide_case_50_exprs                            1.00      2.4±0.01ms        ? ?/sec    1.00      2.4±0.00ms        ? ?/sec
logical_wide_filter_200_predicates                    1.00  1326.8±11.20µs        ? ?/sec    1.00  1324.4±14.04µs        ? ?/sec
logical_wide_filter_50_predicates                     1.01    399.4±7.35µs        ? ?/sec    1.00    394.5±2.60µs        ? ?/sec
optimizer_correlated_exists                           1.00    250.2±1.57µs        ? ?/sec    1.01    251.5±2.44µs        ? ?/sec
optimizer_join_4_with_agg_filter                      1.03    484.8±1.74µs        ? ?/sec    1.00    469.8±2.56µs        ? ?/sec
optimizer_join_chain_4                                1.02    184.0±0.39µs        ? ?/sec    1.00    180.7±1.11µs        ? ?/sec
optimizer_join_chain_8                                1.01    569.6±1.32µs        ? ?/sec    1.00    565.3±4.21µs        ? ?/sec
optimizer_select_all_from_1000                        1.00      6.8±0.02ms        ? ?/sec    1.00      6.8±0.03ms        ? ?/sec
optimizer_select_one_from_700                         1.00    255.4±0.67µs        ? ?/sec    1.01    258.4±2.55µs        ? ?/sec
optimizer_tpcds_all                                   1.01    316.2±0.94ms        ? ?/sec    1.00    311.8±1.50ms        ? ?/sec
optimizer_tpch_all                                    1.03     18.1±0.10ms        ? ?/sec    1.00     17.6±0.08ms        ? ?/sec
optimizer_wide_aggregate_100                          1.00      2.3±0.01ms        ? ?/sec    1.01      2.3±0.03ms        ? ?/sec
optimizer_wide_filter_200                             1.00      3.7±0.01ms        ? ?/sec    1.00      3.7±0.03ms        ? ?/sec
physical_intersection                                 1.00    612.9±1.90µs        ? ?/sec    1.00    610.9±2.06µs        ? ?/sec
physical_join_consider_sort                           1.01   1058.5±2.25µs        ? ?/sec    1.00   1051.1±2.82µs        ? ?/sec
physical_join_distinct                                1.03   271.9±12.14µs        ? ?/sec    1.00    264.7±1.43µs        ? ?/sec
physical_many_self_joins                              1.00      7.7±0.04ms        ? ?/sec    1.00      7.7±0.03ms        ? ?/sec
physical_plan_clickbench_all                          1.01    131.8±1.06ms        ? ?/sec    1.00    131.0±1.16ms        ? ?/sec
physical_plan_clickbench_q1                           1.02   1454.9±9.88µs        ? ?/sec    1.00  1426.5±15.02µs        ? ?/sec
physical_plan_clickbench_q10                          1.04      2.2±0.02ms        ? ?/sec    1.00      2.1±0.01ms        ? ?/sec
physical_plan_clickbench_q11                          1.03      2.3±0.03ms        ? ?/sec    1.00      2.2±0.01ms        ? ?/sec
physical_plan_clickbench_q12                          1.02      2.4±0.01ms        ? ?/sec    1.00      2.3±0.01ms        ? ?/sec
physical_plan_clickbench_q13                          1.01      2.1±0.01ms        ? ?/sec    1.00      2.1±0.01ms        ? ?/sec
physical_plan_clickbench_q14                          1.03      2.3±0.02ms        ? ?/sec    1.00      2.2±0.01ms        ? ?/sec
physical_plan_clickbench_q15                          1.00      2.2±0.01ms        ? ?/sec    1.00      2.2±0.02ms        ? ?/sec
physical_plan_clickbench_q16                          1.00   1855.1±7.00µs        ? ?/sec    1.00  1852.0±21.37µs        ? ?/sec
physical_plan_clickbench_q17                          1.03  1951.1±11.13µs        ? ?/sec    1.00  1896.8±12.09µs        ? ?/sec
physical_plan_clickbench_q18                          1.03  1775.7±16.81µs        ? ?/sec    1.00   1723.9±8.86µs        ? ?/sec
physical_plan_clickbench_q19                          1.03      2.2±0.02ms        ? ?/sec    1.00      2.1±0.01ms        ? ?/sec
physical_plan_clickbench_q2                           1.00   1815.5±7.24µs        ? ?/sec    1.01  1838.8±25.95µs        ? ?/sec
physical_plan_clickbench_q20                          1.01  1563.2±19.83µs        ? ?/sec    1.00   1551.1±8.54µs        ? ?/sec
physical_plan_clickbench_q21                          1.02   1845.6±8.83µs        ? ?/sec    1.00  1800.6±11.69µs        ? ?/sec
physical_plan_clickbench_q22                          1.03      2.3±0.02ms        ? ?/sec    1.00      2.2±0.02ms        ? ?/sec
physical_plan_clickbench_q23                          1.04      2.5±0.04ms        ? ?/sec    1.00      2.4±0.01ms        ? ?/sec
physical_plan_clickbench_q24                          1.04      6.9±0.06ms        ? ?/sec    1.00      6.6±0.05ms        ? ?/sec
physical_plan_clickbench_q25                          1.02   1975.7±9.18µs        ? ?/sec    1.00  1929.0±11.65µs        ? ?/sec
physical_plan_clickbench_q26                          1.01   1803.6±8.30µs        ? ?/sec    1.00  1787.6±15.01µs        ? ?/sec
physical_plan_clickbench_q27                          1.01      2.0±0.01ms        ? ?/sec    1.00  1990.3±17.74µs        ? ?/sec
physical_plan_clickbench_q28                          1.02      2.4±0.02ms        ? ?/sec    1.00      2.4±0.01ms        ? ?/sec
physical_plan_clickbench_q29                          1.00      2.6±0.02ms        ? ?/sec    1.00      2.6±0.01ms        ? ?/sec
physical_plan_clickbench_q3                           1.00  1713.0±10.44µs        ? ?/sec    1.02  1746.1±21.25µs        ? ?/sec
physical_plan_clickbench_q30                          1.02     15.7±0.09ms        ? ?/sec    1.00     15.4±0.12ms        ? ?/sec
physical_plan_clickbench_q31                          1.00      2.5±0.01ms        ? ?/sec    1.00      2.5±0.01ms        ? ?/sec
physical_plan_clickbench_q32                          1.00      2.5±0.01ms        ? ?/sec    1.00      2.5±0.02ms        ? ?/sec
physical_plan_clickbench_q33                          1.00      2.1±0.01ms        ? ?/sec    1.01      2.1±0.01ms        ? ?/sec
physical_plan_clickbench_q34                          1.00   1843.0±8.52µs        ? ?/sec    1.01  1866.2±15.78µs        ? ?/sec
physical_plan_clickbench_q35                          1.00  1898.1±12.75µs        ? ?/sec    1.00  1901.8±10.71µs        ? ?/sec
physical_plan_clickbench_q36                          1.02      2.2±0.03ms        ? ?/sec    1.00      2.2±0.01ms        ? ?/sec
physical_plan_clickbench_q37                          1.00      2.6±0.02ms        ? ?/sec    1.00      2.6±0.02ms        ? ?/sec
physical_plan_clickbench_q38                          1.00      2.6±0.02ms        ? ?/sec    1.00      2.6±0.02ms        ? ?/sec
physical_plan_clickbench_q39                          1.00      2.6±0.01ms        ? ?/sec    1.01      2.7±0.02ms        ? ?/sec
physical_plan_clickbench_q4                           1.00   1517.9±6.60µs        ? ?/sec    1.02  1548.5±15.48µs        ? ?/sec
physical_plan_clickbench_q40                          1.00      3.4±0.03ms        ? ?/sec    1.00      3.4±0.04ms        ? ?/sec
physical_plan_clickbench_q41                          1.00      2.9±0.02ms        ? ?/sec    1.00      2.9±0.02ms        ? ?/sec
physical_plan_clickbench_q42                          1.00      3.1±0.01ms        ? ?/sec    1.00      3.1±0.02ms        ? ?/sec
physical_plan_clickbench_q43                          1.00      3.2±0.02ms        ? ?/sec    1.00      3.2±0.08ms        ? ?/sec
physical_plan_clickbench_q44                          1.00   1599.8±6.29µs        ? ?/sec    1.02   1629.0±9.66µs        ? ?/sec
physical_plan_clickbench_q45                          1.00   1605.8±7.37µs        ? ?/sec    1.01   1625.8±7.81µs        ? ?/sec
physical_plan_clickbench_q46                          1.00   1936.3±9.14µs        ? ?/sec    1.00  1931.9±12.19µs        ? ?/sec
physical_plan_clickbench_q47                          1.02      2.7±0.05ms        ? ?/sec    1.00      2.6±0.01ms        ? ?/sec
physical_plan_clickbench_q48                          1.03      2.9±0.03ms        ? ?/sec    1.00      2.8±0.01ms        ? ?/sec
physical_plan_clickbench_q49                          1.01      2.9±0.02ms        ? ?/sec    1.00      2.9±0.02ms        ? ?/sec
physical_plan_clickbench_q5                           1.00   1662.4±9.89µs        ? ?/sec    1.01  1687.0±21.24µs        ? ?/sec
physical_plan_clickbench_q50                          1.01      2.7±0.03ms        ? ?/sec    1.00      2.7±0.01ms        ? ?/sec
physical_plan_clickbench_q51                          1.00      2.1±0.01ms        ? ?/sec    1.00      2.1±0.01ms        ? ?/sec
physical_plan_clickbench_q6                           1.00   1661.8±6.72µs        ? ?/sec    1.01  1680.3±13.93µs        ? ?/sec
physical_plan_clickbench_q7                           1.00   1470.2±7.50µs        ? ?/sec    1.00   1463.0±8.42µs        ? ?/sec
physical_plan_clickbench_q8                           1.00   1980.1±7.89µs        ? ?/sec    1.00  1977.1±12.46µs        ? ?/sec
physical_plan_clickbench_q9                           1.01   1993.9±8.77µs        ? ?/sec    1.00   1976.5±9.30µs        ? ?/sec
physical_plan_struct_join_agg_sort                    1.03   1350.0±2.40µs        ? ?/sec    1.00   1313.0±4.30µs        ? ?/sec
physical_plan_tpcds_all                               1.00    736.5±4.97ms        ? ?/sec    1.00    738.4±7.63ms        ? ?/sec
physical_plan_tpch_all                                1.03     46.3±0.31ms        ? ?/sec    1.00     45.0±0.13ms        ? ?/sec
physical_plan_tpch_q1                                 1.04   1622.3±2.48µs        ? ?/sec    1.00   1559.5±2.85µs        ? ?/sec
physical_plan_tpch_q10                                1.02      2.9±0.01ms        ? ?/sec    1.00      2.8±0.01ms        ? ?/sec
physical_plan_tpch_q11                                1.02      2.3±0.01ms        ? ?/sec    1.00      2.3±0.01ms        ? ?/sec
physical_plan_tpch_q12                                1.01   1311.7±4.22µs        ? ?/sec    1.00   1292.9±2.48µs        ? ?/sec
physical_plan_tpch_q13                                1.03   1099.3±1.87µs        ? ?/sec    1.00   1066.3±2.84µs        ? ?/sec
physical_plan_tpch_q14                                1.04   1465.5±3.25µs        ? ?/sec    1.00   1405.1±4.49µs        ? ?/sec
physical_plan_tpch_q16                                1.03   1677.5±2.78µs        ? ?/sec    1.00   1635.4±3.04µs        ? ?/sec
physical_plan_tpch_q17                                1.04   1716.0±3.08µs        ? ?/sec    1.00   1653.2±4.59µs        ? ?/sec
physical_plan_tpch_q18                                1.01      2.0±0.01ms        ? ?/sec    1.00      2.0±0.00ms        ? ?/sec
physical_plan_tpch_q19                                1.02   1943.3±3.95µs        ? ?/sec    1.00   1914.4±6.68µs        ? ?/sec
physical_plan_tpch_q2                                 1.01      3.7±0.01ms        ? ?/sec    1.00      3.7±0.01ms        ? ?/sec
physical_plan_tpch_q20                                1.03      2.2±0.02ms        ? ?/sec    1.00      2.2±0.00ms        ? ?/sec
physical_plan_tpch_q21                                1.02      2.9±0.01ms        ? ?/sec    1.00      2.9±0.01ms        ? ?/sec
physical_plan_tpch_q22                                1.06   1596.7±3.20µs        ? ?/sec    1.00   1510.1±5.20µs        ? ?/sec
physical_plan_tpch_q3                                 1.00   1920.1±4.95µs        ? ?/sec    1.01   1929.9±4.31µs        ? ?/sec
physical_plan_tpch_q4                                 1.00   1239.9±8.48µs        ? ?/sec    1.01   1251.1±1.90µs        ? ?/sec
physical_plan_tpch_q5                                 1.01      2.8±0.02ms        ? ?/sec    1.00      2.8±0.01ms        ? ?/sec
physical_plan_tpch_q6                                 1.00    649.0±1.68µs        ? ?/sec    1.00    651.1±1.94µs        ? ?/sec
physical_plan_tpch_q7                                 1.01      2.9±0.01ms        ? ?/sec    1.00      2.9±0.03ms        ? ?/sec
physical_plan_tpch_q8                                 1.02      4.0±0.02ms        ? ?/sec    1.00      3.9±0.01ms        ? ?/sec
physical_plan_tpch_q9                                 1.02      2.8±0.00ms        ? ?/sec    1.00      2.7±0.01ms        ? ?/sec
physical_select_aggregates_from_200                   1.00     15.6±0.07ms        ? ?/sec    1.00     15.5±0.04ms        ? ?/sec
physical_select_all_from_1000                         1.02    117.9±1.70ms        ? ?/sec    1.00    115.2±0.25ms        ? ?/sec
physical_select_one_from_700                          1.01    771.5±1.56µs        ? ?/sec    1.00    763.2±2.07µs        ? ?/sec
physical_sorted_union_order_by_10_int64               1.01      4.4±0.02ms        ? ?/sec    1.00      4.4±0.01ms        ? ?/sec
physical_sorted_union_order_by_10_uint64              1.02      9.3±0.02ms        ? ?/sec    1.00      9.1±0.04ms        ? ?/sec
physical_sorted_union_order_by_50_int64               1.00    107.6±0.65ms        ? ?/sec    1.00    107.5±0.66ms        ? ?/sec
physical_sorted_union_order_by_50_uint64              1.01    418.8±2.18ms        ? ?/sec    1.00    415.4±2.85ms        ? ?/sec
physical_theta_join_consider_sort                     1.00   1080.2±2.51µs        ? ?/sec    1.01  1091.2±15.20µs        ? ?/sec
physical_unnest_to_join                               1.00    646.0±1.38µs        ? ?/sec    1.00    645.2±1.87µs        ? ?/sec
physical_window_function_partition_by_12_on_values    1.01    726.6±1.18µs        ? ?/sec    1.00    719.4±1.60µs        ? ?/sec
physical_window_function_partition_by_30_on_values    1.00   1431.9±2.70µs        ? ?/sec    1.00   1426.9±2.47µs        ? ?/sec
physical_window_function_partition_by_4_on_values     1.03    455.3±1.59µs        ? ?/sec    1.00    441.8±1.27µs        ? ?/sec
physical_window_function_partition_by_7_on_values     1.03    557.2±1.58µs        ? ?/sec    1.00    538.8±3.88µs        ? ?/sec
physical_window_function_partition_by_8_on_values     1.03    597.6±1.72µs        ? ?/sec    1.00    580.7±1.29µs        ? ?/sec
with_param_values_many_columns                        1.00    435.5±1.79µs        ? ?/sec    1.00    435.9±1.99µs        ? ?/sec

Resource Usage

sql_planner — base (merge-base)

Metric Value
Wall time 2375.5s
Peak memory 130.5 MiB
Avg memory 66.3 MiB
CPU user 1883.7s
CPU sys 1.5s
Peak spill 0 B

sql_planner — branch

Metric Value
Wall time 2480.5s
Peak memory 131.4 MiB
Avg memory 64.8 MiB
CPU user 1887.7s
CPU sys 1.4s
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

optimizer Optimizer rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OptimizeProjections: projection schema construction is O(exprs × width)

4 participants