Repository navigation
Commit c040fbb
ref(db): Drop unused Group.logger indexes (#128334)
Drops the two indexes that `db_index=True` creates on `Group.logger`:
- `sentry_groupedmessage_logger_993cb6d5`, a btree on `logger`
- `sentry_groupedmessage_logger_993cb6d5_like`, a btree on `logger
varchar_pattern_ops` that Django adds for `LIKE` lookups on `CharField`s
This is a follow-up to #128156 (`level`) and #128165 (`times_seen`).
### Why
- Nothing in `src/` filters, orders, or runs `LIKE` lookups on
`Group.logger` in Postgres, so both indexes only add write overhead on
`sentry_groupedmessage`.
- Neither is unique or a constraint.
### How
Same pattern as `1228`/`1229`:
- Removed `db_index=True` from `Group.logger`.
- Migration `1231_drop_group_logger_indexes` uses
`SeparateDatabaseAndState`:
- The database side runs `DROP INDEX CONCURRENTLY IF EXISTS` for both
Django names, and for the South-era names `sentry_groupedmessage_logger`
and `sentry_groupedmessage_logger_like`. Dropping by exact name keeps
`AlterField` from introspecting and dropping other indexes.
- The state side is an `AlterField` matching the model.
- `use_statement_timeout=False`, because the concurrent drops wait for
open transactions.
- `is_post_deployment = True`.
- Reversible: the reverse SQL recreates both indexes under their current
names, including `varchar_pattern_ops` on the `_like` index.
### Notes for reviewers
- `SafeRunSQL` needs sign-off from `owners-migrations`.
- I couldn't run `makemigrations --check` or `sqlmigrate` locally, so
please rely on CI and the migration SQL comment.
<!-- junior-request-attribution:start -->
via **michal**.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!-- junior-conversation-id:local%3Aweb%3Ae4ce2a50461aaf3812f0494a -->
--
[View Junior Session in
Sentry](https://sentry.sentry.io/explore/conversations/local%3Aweb%3Ae4ce2a50461aaf3812f0494a/?project=4510944073809921)
<!-- junior-session-footer:end -->
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: michal <michal.kuffa@sentry.io>1 parent 1e42114 commit c040fbb
3 files changed
Lines changed: 78 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
864 | 864 | | |
865 | 865 | | |
866 | 866 | | |
867 | | - | |
868 | | - | |
869 | | - | |
| 867 | + | |
870 | 868 | | |
871 | 869 | | |
872 | 870 | | |
| |||
0 commit comments