feat(cells): add db migration for synapse#109615
Merged
Conversation
this migration replaces the single-column db_index=True on OrganizationMapping.date_updated with a composite expression index on (TruncSecond(date_updated), id), which matches the synapse paginator's order by and where clause. this avoids expensive sequential scans or any additional sorting steps.
Contributor
|
This PR has a migration; here is the generated SQL for for --
-- Create index sentry_orgmapping_date_updated_id_idx on TruncSecond(F(date_updated)), F(id) on model organizationmapping
--
CREATE INDEX CONCURRENTLY "sentry_orgmapping_date_updated_id_idx" ON "sentry_organizationmapping" ((DATE_TRUNC('second', "date_updated" AT TIME ZONE 'UTC')), "id");
--
-- Alter field date_updated on organizationmapping
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_organizationmapping_date_updated_cb5e0369"; |
markstory
approved these changes
Feb 27, 2026
wedamija
approved these changes
Feb 27, 2026
| disable_member_invite = models.BooleanField(default=False, db_default=False) | ||
|
|
||
| date_updated = models.DateTimeField(db_default=Now(), auto_now=True, db_index=True) | ||
| date_updated = models.DateTimeField(db_default=Now(), auto_now=True) |
Member
There was a problem hiding this comment.
lgtm, I assume we don't use this specific index for other queries?
Member
Author
There was a problem hiding this comment.
no, the field was added recently for this project and hasn't been used yet
jan-auer
added a commit
that referenced
this pull request
Mar 2, 2026
…ept-encoding * origin/master: (63 commits) fix(api): Add missing cursor query parameter to paginated endpoint OpenAPI schemas (#109642) docs(sentry-apps): Add sentryAppId to sentry-app-installations API schema (#109628) feat(occurrences on eap): Implement double reads from EAP in organization events trace API endpoint (#109391) feat(occurrences on eap): Implement double reads from EAP for reprocessing2 flow (#109345) feat(ci): report backend test fails (#109543) feat(seer): Add signed viewer context header to Seer API requests (#109626) devenv: cleanup devenv-managed uv (#109617) feat(seer): Iterate on the instructions at the top of seer settings pages (#109586) ref(seer): Add typed wrappers for remaining Seer API callsites (#109607) feat(preprod): Make snapshots endpoint org scoped (#109575) chore: capture exception (#109620) fix(formatting): run ruff format (#109618) feat(preprod): Create admin gated recompare snapshots endpoint (#109546) feat(cells): expand locality/cell distinction (#109538) feat(cells): add db migration for synapse (#109615) feat(preprod): Add public install-details endpoint and shared utilities (#109583) fix(tests): Fix flaky test_cross_trace_query_with_spans_and_logs (#109572) fix(grouping): Resolve mypy possibly-undefined errors in grouphash caching (#109602) fix(dashboards): Default axisRange to auto for existing widgets in builder (#109598) fix(billing): Fix category display names in pending changes (#109612) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this migration replaces the single-column
db_index=TrueonOrganizationMapping.date_updatedwith a composite expression index on(TruncSecond(date_updated), id), which matches the synapse paginator's order by and where clause.this avoids expensive sequential scans or any additional sorting steps.
this is a post-deploy migration.