Skip to content

Misc minor optimizations to query optimizer performance#21128

Draft
AdamGS wants to merge 3 commits intoapache:mainfrom
AdamGS:adamg/optimizer-memory-optimizations
Draft

Misc minor optimizations to query optimizer performance#21128
AdamGS wants to merge 3 commits intoapache:mainfrom
AdamGS:adamg/optimizer-memory-optimizations

Conversation

@AdamGS
Copy link
Contributor

@AdamGS AdamGS commented Mar 23, 2026

Which issue does this PR close?

  • Closes #.

Rationale for this change

Inspired by @blaginin, trying to find more places that might drag the optimizer's performance. On my laptop , this improves many of the sql planner's benchmarks by a fairly consistent 2-5% on my laptop.

What changes are included in this PR?

Are these changes tested?

Existing tests.

Are there any user-facing changes?

None

@AdamGS AdamGS force-pushed the adamg/optimizer-memory-optimizations branch from d71431d to eec93a2 Compare March 23, 2026 19:25
@github-actions github-actions bot added the optimizer Optimizer rules label Mar 23, 2026
true
}

#[expect(clippy::only_used_in_recursion)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is just wasteful, just a lint away.

let left_schema = join.left.schema();
let right_schema = join.right.schema();

let left_schema_columns = schema_columns(left_schema.as_ref());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there might be an even better thing here, but I need to do another pass


fn analyze(&self, plan: LogicalPlan, config: &ConfigOptions) -> Result<LogicalPlan> {
let empty_schema = DFSchema::empty();
static EMPTY_SCHEMA: LazyLock<DFSchema> = LazyLock::new(DFSchema::empty);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

empty DFSchema isn't free, similar to #20534

AdamGS added 2 commits March 23, 2026 20:03
Signed-off-by: Adam Gutglick <adamgsal@gmail.com>
Signed-off-by: Adam Gutglick <adamgsal@gmail.com>
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.

1 participant