perf: skip building FilterRemapper when there are no parent filters - #24428
Open
Braedon-Wooding-Displayr wants to merge 2 commits into
Open
perf: skip building FilterRemapper when there are no parent filters#24428Braedon-Wooding-Displayr wants to merge 2 commits into
Braedon-Wooding-Displayr wants to merge 2 commits into
Conversation
ChildFilterDescription::from_child (and from_child_with_allowed_indices) built a FilterRemapper before checking whether parent_filters was empty. FilterRemapper::new indexes every column of the child's schema into a HashMap, and with no filters to remap that index is never used: remap_filters returns an empty description regardless of what the remapper contains. Each plan node produces one ChildFilterDescription per child, so a union pays this cost once per child. On a 250,000-column scan a sampling profile put FilterRemapper::new at 794 of 20,373 samples, almost entirely HashMap insertion and hashing. Return ChildFilterDescription::empty() directly when parent_filters is empty, before the remapper is built.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24428 +/- ##
==========================================
- Coverage 81.24% 81.24% -0.01%
==========================================
Files 1112 1112
Lines 390912 390924 +12
Branches 390912 390924 +12
==========================================
Hits 317604 317604
- Misses 54670 54678 +8
- Partials 18638 18642 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ChildFilterDescription::from_child (and from_child_with_allowed_indices) built a FilterRemapper before checking whether parent_filters was empty. FilterRemapper::new indexes every column of the child's schema into a HashMap, and with no filters to remap that index is never used: remap_filters returns an empty description regardless of what the remapper contains.
Each plan node produces one ChildFilterDescription per child, so a union pays this cost once per child. On a 250,000-column scan a sampling profile put FilterRemapper::new at 794 of 20,373 samples, almost entirely HashMap insertion and hashing. Return ChildFilterDescription::empty() directly when parent_filters is empty, before the remapper is built.
Which issue does this PR close?
Do I need an issue for this change, it feels like a really minor fix?