Skip to content

perf: stop count(*) when count is not used#2303

Merged
chenba merged 3 commits into
masterfrom
perf/stop-the-count-stor-215
May 13, 2026
Merged

perf: stop count(*) when count is not used#2303
chenba merged 3 commits into
masterfrom
perf/stop-the-count-stor-215

Conversation

@chenba
Copy link
Copy Markdown
Collaborator

@chenba chenba commented May 12, 2026

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

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.
@chenba chenba requested review from pjenvey and taddes May 12, 2026 20:19
Copy link
Copy Markdown
Member

@pjenvey pjenvey left a comment

Choose a reason for hiding this comment

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

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).

@chenba chenba merged commit 3963171 into master May 13, 2026
26 checks passed
@chenba chenba deleted the perf/stop-the-count-stor-215 branch May 13, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants