sentry
sentry copied to clipboard
perf(group): add type index to improve querying on groups
Adds a compound index ("project", "type", "status", "last_seen", "id") to improve query performance.
Growth team is currently observing timeouts for large projects so this is required.
Fixes WOR-2122
This PR has a migration; here is the generated SQL for src/sentry/migrations/0317_groupedmessage_type_index.py ()
--
-- Custom state/database change combination
--
CREATE INDEX CONCURRENTLY IF NOT EXISTS "sentry_groupedmessage_project_id_type_status_l_074196b6_idx" ON "sentry_groupedmessage" ("project_id", "status", "type", "last_seen", "id");
;
- are there any other query patterns besides here this is intending to help? I'm wondering if it may be more advantageous to switch the order of
typeandstatus, since when we filter ontypeit seems like it will usually be a range, which means thatstatuswill only be used as a filter.
Good callout! I think your suggestion makes sense. I made the change - let me know if I need to make any other changes.