fix(trends): only filter breakdown values when needed #21219
Merged
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.
Problem
Some new trends queries with breakdowns are slower than their legacy brethren because we always filter them to only include all breakdown values. Sometimes that's all values and the filter is unnecessary.
Changes
Stop adding the breakdown filter if we're selecting all values. Essentially just when the "other" group is enabled.
Anecdotally, this makes some queries feel twice as fast.
How did you test this code?
There are updated snapshots, and I ran queries locally to verify they return what they should.
I'm really not sure what other kinds of test can I add here. I can replace the
true
(see snapshots) with6 == 6
and check for that magic combination in the returned AST, but that's steering towards testing a specific implementation, not the effect... so I'm not convinced.Ideally this is a change that would just be recorded in a benchmark suite somewhere, but we don't have one hooked up right now. Right now I'd like to unblock myself and move fast 😅