perf: stop count(*) when count is not used#2303
Merged
Merged
Conversation
For the Spanner backend we count the number of bsos for a given uid+kid+collection_id, but then we ingore the actual value. This patch updates the query to see if there are any rows.
pjenvey
approved these changes
May 13, 2026
Member
There was a problem hiding this comment.
This looks good but going back to the old version of this code before the quota support was added, I notice it wasn't even doing any select on bsos. As when quota's disabled, it's really just doing an upsert to update the modified time on user_collections.
I logged https://mozilla-hub.atlassian.net/browse/STOR-564 for changing at least the end of this method to an upsert, I think we could improve further here on both by separating out the quota support from the non quota support version of this method (the other impls somewhat do this).
(We explicitly avoid touching the quota columns in this impl though as it adds to the mutation count).
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.
For the Spanner backend we count the number of bsos for a given uid+kid+collection_id, but then we ingore the actual value. This patch updates the query to see if there are any rows.
Issue(s)
Closes STOR-215