Skip to content

feat(commits): add a (date_added, id) index to sentry_commit - #130862

Open
ldelvoye wants to merge 2 commits into
masterfrom
ldelvoye/feat/commit-date-added-index
Open

ldelvoye wants to merge 2 commits into
masterfrom
ldelvoye/feat/commit-date-added-index

Conversation

@ldelvoye

Copy link
Copy Markdown
Member

resolves INFRENG-1013

Adds a (date_added, id) index to sentry_commit so the unused-commit cleanup can range-scan by date instead of walking the table in id order.

The migration is post-deployment, so the index only exists once someone runs it by hand in each region. It drops the index name first because a failed concurrent build leaves an invalid index behind that would otherwise block the retry.

Lets the unused-commit cleanup range-scan by date instead of walking
the table in id order. Post-deployment, built concurrently.
@linear-code

linear-code Bot commented Nov 12, 2026

Copy link
Copy Markdown

INFRENG-1013

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/migrations/1256_commit_date_added_id_index.py

for 1256_commit_date_added_id_index in sentry

--
-- Raw SQL operation
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_comm_date_ad_740455_idx";
--
-- Create index sentry_comm_date_ad_740455_idx on field(s) date_added, id of model commit
--
CREATE INDEX CONCURRENTLY "sentry_comm_date_ad_740455_idx" ON "sentry_commit" ("date_added", "id");

@ldelvoye
ldelvoye marked this pull request as ready for review November 12, 2026 00:28
@ldelvoye
ldelvoye requested review from a team as code owners November 12, 2026 00:28
@ldelvoye
ldelvoye added this pull request to stack #130870 November 12, 2026 00:52
]

operations = [
# AddIndex builds concurrently; a failed build leaves an invalid index that blocks a retry.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that our framework doesn't handle retries properly here?

This branch has not been deployed

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

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants