Repository navigation
ref(db): Drop unused Group.logger indexes - #128334
Merged
Merged
Conversation
Nothing queries Group by logger in Postgres, so the btree and varchar_pattern_ops indexes created by db_index=True only add write overhead. Drop them (and their South-era names) with DROP INDEX CONCURRENTLY IF EXISTS as a post-deployment migration. Co-Authored-By: michal <michal.kuffa@sentry.io>
vgrozdanic
approved these changes
Oct 21, 2026
Contributor
|
This PR has a migration; here is the generated SQL for for --
-- Custom state/database change combination
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_groupedmessage_logger_993cb6d5";
DROP INDEX CONCURRENTLY IF EXISTS "sentry_groupedmessage_logger_993cb6d5_like";
DROP INDEX CONCURRENTLY IF EXISTS "sentry_groupedmessage_logger";
DROP INDEX CONCURRENTLY IF EXISTS "sentry_groupedmessage_logger_like"; |
2 tasks 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.
Drops the two indexes that
db_index=Truecreates onGroup.logger:sentry_groupedmessage_logger_993cb6d5, a btree onloggersentry_groupedmessage_logger_993cb6d5_like, a btree onlogger varchar_pattern_opsthat Django adds forLIKElookups onCharFieldsThis is a follow-up to #128156 (
level) and #128165 (times_seen).Why
src/filters, orders, or runsLIKElookups onGroup.loggerin Postgres, so both indexes only add write overhead onsentry_groupedmessage.How
Same pattern as
1228/1229:db_index=TruefromGroup.logger.1231_drop_group_logger_indexesusesSeparateDatabaseAndState:DROP INDEX CONCURRENTLY IF EXISTSfor both Django names, and for the South-era namessentry_groupedmessage_loggerandsentry_groupedmessage_logger_like. Dropping by exact name keepsAlterFieldfrom introspecting and dropping other indexes.AlterFieldmatching the model.use_statement_timeout=False, because the concurrent drops wait for open transactions.is_post_deployment = True.varchar_pattern_opson the_likeindex.Notes for reviewers
SafeRunSQLneeds sign-off fromowners-migrations.makemigrations --checkorsqlmigratelocally, so please rely on CI and the migration SQL comment.via michal.
--
View Junior Session in Sentry