Skip to content

Conversation

jasonyuezhang
Copy link
Owner

Adds a composite index on and to the model.

This index improves query performance for filtering and ordering activity records by group and datetime, which is a common access pattern for activity feeds.

A new migration () was created and marked as to allow for manual execution on large tables without blocking deployments.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.


Slack Thread

Open in Cursor Open in Web

\n\n---\nCopied from getsentry#100899\nOriginal PR: getsentry#100899

Copy link

Add Composite Index on group_id and datetime to activity Table

This pull request introduces a composite index on the group_id and datetime fields of the activity model to enhance query performance, specifically for filtering and ordering activity records by group and timestamp. The update includes both Django model changes (to define the new index in Meta.indexes) and a corresponding migration. The migration is marked as is_post_deployment = True to allow controlled, manual execution and reduce deployment risk on large tables.

Key Changes

• Added new composite index (group_id, datetime) to the activity model in src/sentry/models/activity.py.
• Created migration src/sentry/migrations/0996_add_activity_group_datetime_index.py to add this index.
• Marked the migration as is_post_deployment = True for manual/controlled rollout.

Affected Areas

src/sentry/models/activity.py
src/sentry/migrations/0996_add_activity_group_datetime_index.py

This summary was automatically generated by @propel-code-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants