Repository navigation
Adjust people index query - #2825
Merged
Merged
Conversation
Collaborator
Collaborator
Collaborator
Author
maebeale
added a commit
that referenced
this pull request
Oct 25, 2026
#2825's contact-info box searches through search_contact, so country joins its attributes and the box's tooltip names it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 task done
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.



Closes [link an issue or remove this line]
What is the goal of this PR and why is this important?
Speed up the people index
How did you approach the change?
The people index was running one 12-table eager_load join with DISTINCT (from .references(:user)), two counts, and a name search that joined users/contact_methods/addresses. Now it preloads instead of the giant join, runs one count, and searches name/email via a joinless scope. The events attendees and staff taggings searches are unchanged.
Phone moves to its own admin-only filter. This could be moved back for a smaller hit but I think for now its fine to break it out of the main search.
Dev numbers (36k people):
before after
default results ~1200s ~150ms
name search count ~200–310ms ~20ms
name search page ~25ms ~6ms
Name search also no longer duplicates rows (was 25 rows / 20 unique; count 329 vs the correct 247).
UI Testing Checklist
Anything else to add?