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.
Building off of the work done in #6906. There was another identified query in that file that could be sped up.
I tried to optimize theThis turned out to be false when actually testing on android. There are semantics we need to keep for ensuring frecency shows up as expected, I did end up having to use an index and thus migration here...WHERE
to be index-friendly and fixing the query itself actually did most of the heavy lifting and we're able to net some free wins by getting it to use existing indexes. So no new index + migration needed here.Bench Stats:
117.69 µs
->4.2667 µs
= 96% speedup! No index needed as well so we don't need a migration here.118.27 µs
->58.014 µs
= 50% speedup, not as cool as above however one of the new indexesidx_visits_place_type
should speed up a few queries actually.Pull Request checklist
[ci full]
to the PR title.