Skip to content

perf(derived data): Bound heal range selection with density sampling - #125093

Merged
kcons merged 5 commits into
masterfrom
kcons/otherway
Sep 23, 2026
Merged

kcons merged 5 commits into
masterfrom
kcons/otherway

Conversation

@kcons

@kcons kcons commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

group_id_ranges_for_hash read one row for every matching group ID in the requested window, so
query cost grew linearly with the scheduling budget and large runs hit occasional timeouts. This
moves to a tunable range estimation via density sampling approach, requiring dramatically
less work for the db.

This makes ranges more approximate than they were before, so regenerate_stale_derived_data_batch caps each batch at issues.derived.heal-batch-size and reschedules the remainder when a range turns out denser than estimated.

@kcons
kcons requested review from a team as code owners September 21, 2026 19:00
@kcons
kcons marked this pull request as draft September 21, 2026 19:00
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 21, 2026
@kcons kcons changed the title WIP: Probable perf(derived data): Bound heal range selection with density sampling Sep 22, 2026
@kcons

kcons commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

bugbot review

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 71cbd6e. Configure here.

@kcons
kcons marked this pull request as ready for review September 22, 2026 22:20
with metrics.timer("issues.derived.group_id_range_query"):

def fetch_group_ids(start: int, limit: int) -> list[int]:
remaining_seconds = query_deadline - time.monotonic()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

nb: I have a helper for this sitting around, but didn't want to make it part of this pr. See #125142

Comment thread src/sentry/issues/derived/tasks.py Outdated
Comment thread src/sentry/issues/derived/tasks.py
Comment thread src/sentry/issues/derived/tasks_util.py
@kcons
kcons merged commit 207addf into master Sep 23, 2026
68 checks passed
@kcons
kcons deleted the kcons/otherway branch September 23, 2026 16:53
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