Skip to content

Commit

Permalink
feat(escalating-issues): Create new index on Group for more efficient…
Browse files Browse the repository at this point in the history
… query (#56345)

## Objective:

Re-revert of #56180

This time with `is_dangerous=True`
  • Loading branch information
NisanthanNanthakumar committed Sep 15, 2023
1 parent 3d05631 commit d6d67fe
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion migrations_lockfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ will then be regenerated, and you should be able to merge without conflicts.
feedback: 0002_feedback_add_org_id_and_rename_event_id
nodestore: 0002_nodestore_no_dictfield
replays: 0003_add_size_to_recording_segment
sentry: 0552_create_neglectedalert_table
sentry: 0553_add_new_index_to_groupedmessage_table
social_auth: 0002_default_auto_field
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated by Django 3.2.20 on 2023-09-15 19:22

from django.db import migrations

from sentry.new_migrations.migrations import CheckedMigration


class Migration(CheckedMigration):
# This flag is used to mark that a migration shouldn't be automatically run in production. For
# the most part, this should only be used for operations where it's safe to run the migration
# after your code has deployed. So this should not be used for most operations that alter the
# schema of a table.
# Here are some things that make sense to mark as dangerous:
# - Large data migrations. Typically we want these to be run manually by ops so that they can
# be monitored and not block the deploy for a long period of time while they run.
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
# have ops run this and not block the deploy. Note that while adding an index is a schema
# change, it's completely safe to run the operation after the code has deployed.
is_dangerous = True

dependencies = [
("sentry", "0552_create_neglectedalert_table"),
]

operations = [
migrations.AlterIndexTogether(
name="group",
index_together={
("project", "status", "last_seen", "id"),
("project", "status", "type", "last_seen", "id"),
("project", "id"),
("project", "status", "substatus", "id"),
("project", "status", "substatus", "last_seen", "id"),
("project", "status", "substatus", "type", "last_seen", "id"),
("project", "first_release"),
("status", "substatus", "id"),
},
),
]
1 change: 1 addition & 0 deletions src/sentry/models/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ class Meta:
("project", "status", "substatus", "last_seen", "id"),
("project", "status", "substatus", "type", "last_seen", "id"),
("project", "status", "substatus", "id"),
("status", "substatus", "id"),
]
unique_together = (
("project", "short_id"),
Expand Down

0 comments on commit d6d67fe

Please sign in to comment.