getsentry / sentry

Developer-first error tracking and performance monitoring
https://sentry.io
Other
37.08k stars 3.98k forks source link

fix(hc): Adds indexes to tombstone columns missing them #70044

Closed GabeVillalobos closed 2 weeks ago

GabeVillalobos commented 2 weeks ago

Adds indexes to tombstone columns that are now used in cross-db queries.

github-actions[bot] commented 2 weeks ago

This PR has a migration; here is the generated SQL for src/sentry/migrations/0710_create_tombstone_indexes.py ()

--
-- Alter field object_identifier on controltombstone
--
CREATE INDEX CONCURRENTLY "sentry_controltombstone_object_identifier_26410aca" ON "sentry_controltombstone" ("object_identifier");
--
-- Alter field table_name on controltombstone
--
CREATE INDEX CONCURRENTLY "sentry_controltombstone_table_name_8ab879b2" ON "sentry_controltombstone" ("table_name");
CREATE INDEX CONCURRENTLY "sentry_controltombstone_table_name_8ab879b2_like" ON "sentry_controltombstone" ("table_name" varchar_pattern_ops);
--
-- Alter field object_identifier on regiontombstone
--
CREATE INDEX CONCURRENTLY "sentry_regiontombstone_object_identifier_fe50d85d" ON "sentry_regiontombstone" ("object_identifier");
--
-- Alter field table_name on regiontombstone
--
CREATE INDEX CONCURRENTLY "sentry_regiontombstone_table_name_8bba6edb" ON "sentry_regiontombstone" ("table_name");
CREATE INDEX CONCURRENTLY "sentry_regiontombstone_table_name_8bba6edb_like" ON "sentry_regiontombstone" ("table_name" varchar_pattern_ops);
codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.84%. Comparing base (aff9a15) to head (7d4a496). Report is 13 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #70044 +/- ## ======================================= Coverage 79.83% 79.84% ======================================= Files 6500 6500 Lines 289121 289115 -6 Branches 49784 49784 ======================================= + Hits 230829 230832 +3 + Misses 57934 57925 -9 Partials 358 358 ``` | [Files](https://app.codecov.io/gh/getsentry/sentry/pull/70044?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | Coverage Δ | | |---|---|---| | [src/sentry/models/tombstone.py](https://app.codecov.io/gh/getsentry/sentry/pull/70044?src=pr&el=tree&filepath=src%2Fsentry%2Fmodels%2Ftombstone.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c3JjL3NlbnRyeS9tb2RlbHMvdG9tYnN0b25lLnB5) | `92.68% <100.00%> (ø)` | | ... and [9 files with indirect coverage changes](https://app.codecov.io/gh/getsentry/sentry/pull/70044/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry)
GabeVillalobos commented 2 weeks ago

Closing this since we already have a compound index. I ran query planner before and after adding these indexes and validated that they won't affect our current queries in any meaningful way 😞