Skip to content

Add new index to users over deleted_at and location_id#17876

Merged
snipe merged 1 commit intogrokability:developfrom
uberbrady:add_users_location_index
Sep 16, 2025
Merged

Add new index to users over deleted_at and location_id#17876
snipe merged 1 commit intogrokability:developfrom
uberbrady:add_users_location_index

Conversation

@uberbrady
Copy link
Copy Markdown
Member

Some location-based queries that join to Users, when there are lots of users, can be slower than they need to be, so this adds an index.

One thing we're doing that's a little weirder than usual is that we're indexing deleted_at first, then doing location_id. This is because we could probably use an index over users deleted_at at some point, and this index will cover that. But we're never going to ask for "all users from this location regardless of whether they're deleted or not" - we always ask for either deleted_at IS NULL or deleted_at IS NOT NULL.

@uberbrady uberbrady requested a review from snipe as a code owner September 16, 2025 10:57
@snipe snipe merged commit 96b5c1d into grokability:develop Sep 16, 2025
4 of 8 checks passed
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