Skip to content

perf(crons): Make the check-in timeout index partial - #131376

Merged
wedamija merged 4 commits into
masterfrom
danf/crons-partial-timeout-index
Nov 16, 2026
Merged

wedamija merged 4 commits into
masterfrom
danf/crons-partial-timeout-index

Conversation

@wedamija

@wedamija wedamija commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Part of a series that shrinks the indexes on sentry_monitorcheckin.

Swaps the (status, timeout_at) index for a partial index on timeout_at over in-progress check-ins, the only rows the timeout task reads. Post-deploy, because it builds an index.

Merge order:

  1. perf(crons): Drop the check-in config FK index #131374
  2. ref(crons): Make the check-in config not null #131375 (post-deploy migration)
  3. perf(crons): Make the check-in timeout index partial #131376 (post-deploy migration) ← this PR

@wedamija
wedamija requested review from a team as code owners November 16, 2026 21:26
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/monitors/migrations/0028_partial_timeout_index.py

for 0028_partial_timeout_index in monitors

--
-- Raw SQL operation
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_monitorcheckin_timeout";
--
-- Create index sentry_monitorcheckin_timeout on field(s) timeout_at of model monitorcheckin
--
CREATE INDEX CONCURRENTLY "sentry_monitorcheckin_timeout" ON "sentry_monitorcheckin" ("timeout_at") WHERE "status" = 3;
--
-- Remove index sentry_moni_status_fe7282_idx from monitorcheckin
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_moni_status_fe7282_idx";

wedamija added a commit that referenced this pull request Nov 16, 2026
Part of a series that shrinks the indexes on `sentry_monitorcheckin`.

Drops the index on `checkin_config_id`. It was only needed to check that
every check-in has a config, and now they all do. Nothing deletes
configs, so the foreign key never needs it.

Merge order:
1. #131374 ← this PR
2. #131375 (post-deploy
migration)
3. #131376 (post-deploy
migration)
wedamija added a commit that referenced this pull request Nov 16, 2026
Part of a series that shrinks the indexes on `sentry_monitorcheckin`.

Every check-in has a config now, so `checkin_config` becomes NOT NULL.
Post-deploy, because validating the constraint scans the whole table.

Merge order:
1. #131374
2. #131375 (post-deploy
migration) ← this PR
3. #131376 (post-deploy
migration)
Base automatically changed from danf/crons-checkin-config-not-null-column to master November 16, 2026 22:44
@wedamija
wedamija requested a review from a team as a code owner November 16, 2026 22:44
# Conflicts:
#	migrations_lockfile.txt
#	src/sentry/monitors/migrations/0026_drop_checkin_config_index.py
#	src/sentry/monitors/migrations/0027_checkin_config_not_null.py
@wedamija
wedamija merged commit 7da8a4f into master Nov 16, 2026
103 checks passed
@wedamija
wedamija deleted the danf/crons-partial-timeout-index branch November 16, 2026 22:54
jan-auer added a commit that referenced this pull request Nov 17, 2026
…-store

* ref/inline-payload-defaults: (2542 commits)
  feat(classifiers): Support search syntax in classifier list query (#131423)
  ref(settings): Update settings tour entry copy (#131424)
  fix(conversations): Track tab switch from the View Timeline button (#131196)
  ref(sourcemaps): Read has_debug_ids in the source map debugger (#130425)
  ci(acceptance): Re-run on the override selective testing label (#131408)
  feat(inbox): Include inbox URLs in item responses (#131406)
  ref(flags): Remove `organizations:jira-explicit-mapping-removals` (frontend) (#130393)
  ci(acceptance): Select acceptance tests on pull requests (#131325)
  fix(audit-log): Render legacy internal integration token entries (#131042)
  ref(api): Drop the isRecord guard from SentryApiError body reads (#131394)
  ref: bump sentry-protos to 0.120.1 (#131396)
  feat(inbox): add URL configuration for inbox events (#131336)
  fix(circuit-breaker): Don't raise from record_error or record_success when redis fails (#131364)
  fix(redis): Let cluster client_args set the per-node connection limit (#131355)
  fix(sentry-apps): Stop retrying service hooks to blocked or unreachable URLs (#131171)
  fix(charts): Stop tooltip errors when a chart refresh removes series (#131341)
  perf(crons): Make the check-in timeout index partial (#131376)
  feat(api): Know per-operation error codes and read top-level codes (#131362)
  feat(api): Generate error codes and challenge fields from the spec (#131287)
  feat(apidocs): Mark auth-challenge error codes in the error component (#131346)
  ...

# Conflicts:
#	src/sentry/conf/server.py
#	src/sentry/event_manager.py
#	src/sentry/ingest/consumer/attachment_event.py
#	src/sentry/ingest/consumer/processors.py
#	src/sentry/processing/backpressure/topology.py
#	src/sentry/tasks/store.py
#	tests/sentry/ingest/ingest_consumer/test_ingest_consumer_kafka.py
#	tests/sentry/ingest/ingest_consumer/test_ingest_consumer_processing.py
#	tests/sentry/processing/backpressure/test_checking.py
#	tests/sentry/processing/backpressure/test_monitoring.py
#	tests/sentry/tasks/test_post_process.py
#	tests/sentry/tasks/test_store.py
#	tests/sentry/tasks/test_symbolication.py
xb18 pushed a commit to xb18/sentry that referenced this pull request Nov 22, 2026
…defaults

* origin/master: (2542 commits)
  feat(classifiers): Support search syntax in classifier list query (getsentry#131423)
  ref(settings): Update settings tour entry copy (getsentry#131424)
  fix(conversations): Track tab switch from the View Timeline button (getsentry#131196)
  ref(sourcemaps): Read has_debug_ids in the source map debugger (getsentry#130425)
  ci(acceptance): Re-run on the override selective testing label (getsentry#131408)
  feat(inbox): Include inbox URLs in item responses (getsentry#131406)
  ref(flags): Remove `organizations:jira-explicit-mapping-removals` (frontend) (getsentry#130393)
  ci(acceptance): Select acceptance tests on pull requests (getsentry#131325)
  fix(audit-log): Render legacy internal integration token entries (getsentry#131042)
  ref(api): Drop the isRecord guard from SentryApiError body reads (getsentry#131394)
  ref: bump sentry-protos to 0.120.1 (getsentry#131396)
  feat(inbox): add URL configuration for inbox events (getsentry#131336)
  fix(circuit-breaker): Don't raise from record_error or record_success when redis fails (getsentry#131364)
  fix(redis): Let cluster client_args set the per-node connection limit (getsentry#131355)
  fix(sentry-apps): Stop retrying service hooks to blocked or unreachable URLs (getsentry#131171)
  fix(charts): Stop tooltip errors when a chart refresh removes series (getsentry#131341)
  perf(crons): Make the check-in timeout index partial (getsentry#131376)
  feat(api): Know per-operation error codes and read top-level codes (getsentry#131362)
  feat(api): Generate error codes and challenge fields from the spec (getsentry#131287)
  feat(apidocs): Mark auth-challenge error codes in the error component (getsentry#131346)
  ...

# Conflicts:
#	tests/sentry/ingest/ingest_consumer/test_ingest_consumer_processing.py
#	tests/sentry/tasks/test_reprocessing2.py
#	tests/sentry/tasks/test_store.py
#	tests/sentry/tasks/test_symbolication.py

This branch was successfully deployed

1 active deployment
Preview — ccb21feb Deployed Nov 16, 2026 by vercel[bot]
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