Skip to content

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Oct 1, 2025

Which issue does this PR close?

Related to XXX

Running benchmarks to see if this helps

Rationale for this change

I spent time profiling the sql_planner benchmarks as part of #17419
and the amount of time spent planning unions was surprising.

What changes are included in this PR?

Are these changes tested?

I also felt bad we haven't really improved planning speed in a while!

I couldn't help myself and implemented a simple optimization to flatten unions
as soon as possible in the planner rather than waiting maybe for the optimizers to do it.
The basic idea is quite simple: if the input is a union, just add its inputs to the list of inputs

Are there any user-facing changes?

not sure

@github-actions github-actions bot added the logical-expr Logical plan and expressions label Oct 1, 2025
@alamb
Copy link
Contributor Author

alamb commented Oct 1, 2025

🤖 ./gh_compare_branch_bench.sh Benchmark Script Running
Linux aal-dev 6.14.0-1016-gcp #17~24.04.1-Ubuntu SMP Wed Sep 3 01:55:36 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing alamb/union_clean (3e19e13) to e0222f0 diff
BENCH_NAME=sql_planner
BENCH_COMMAND=cargo bench --bench sql_planner
BENCH_FILTER=
BENCH_BRANCH_NAME=alamb_union_clean
Results will be posted here when complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant