Add GIN trigram index on bugscache.summary#9555
Open
camd wants to merge 1 commit into
Open
Conversation
Bugscache.search() filters with `summary ILIKE '%term%'` and orders by trigram similarity. The existing btree index on summary cannot serve substring or similarity matching, so every search does a sequential scan of the bugscache table. Add a GIN trigram index (gin_trgm_ops) on summary so those searches can use an index scan. Built CONCURRENTLY (non-atomic migration) to avoid a write lock on the table. The pg_trgm extension is already enabled (migration 0031).
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.
Bugscache.search() and the create_bug endpoint loaded full Bugscache
rows when only a subset of columns is actually used:
modifiedandprocessed_updatevia .only(), sinceserialize() excludes them anyway. Remove the dead
jobmapentry fromthe serialize() exclude list (a reverse relation model_to_dict never
iterates).
fetching the whole row, restrict the summary fallback query with
.only(), and limit the linking save() to the two changed columns via
update_fields.
Add tests covering the create_bug internal-id resolution paths.