Skip to content

docs: Document that adding new optimizer rules are expensive#20348

Open
alamb wants to merge 2 commits intoapache:mainfrom
alamb:alamb/optimizer_rule_slowness
Open

docs: Document that adding new optimizer rules are expensive#20348
alamb wants to merge 2 commits intoapache:mainfrom
alamb:alamb/optimizer_rule_slowness

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented Feb 13, 2026

Which issue does this PR close?

Rationale for this change

As part of PR reviews, it seems like it is not obvious to some contributors that there is a non trivial cost to adding new optimizer rules. Let's add that knowledge into the codebase as comments, so it may be less of a surprise

What changes are included in this PR?

Add comments

Are these changes tested?

N/A

Are there any user-facing changes?

No this is entirely internal comments oly

@alamb alamb added the documentation Improvements or additions to documentation label Feb 13, 2026
@github-actions github-actions bot added optimizer Optimizer rules and removed documentation Improvements or additions to documentation labels Feb 13, 2026
Copy link
Contributor

@adriangb adriangb left a comment

Choose a reason for hiding this comment

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

Left a small suggestion

Comment on lines +242 to +244
// - Adding a new rule here is expensive as it will be applied to all
// queries, and will likely increase the optimization time. Please extend
// existing rules when possible, rather than adding a new rule.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// - Adding a new rule here is expensive as it will be applied to all
// queries, and will likely increase the optimization time. Please extend
// existing rules when possible, rather than adding a new rule.
// - Adding a new rule here is expensive as it will be applied to all
// queries, and will likely increase the optimization time. Please extend
// existing rules when possible, rather than adding a new rule.
// If you do add a new rule considering having aggressive no-op paths
// (e.g. if the plan doesn't contain any of the nodes you are looking for
// return `Transformed::no`; only works if you control the traversal).

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.

3 participants