Skip to content

Commit 9e37c01

Browse files
mrduncanmchen-sentry
authored andcommitted
perf(issues): Fix N+1 project queries in bulk_transition_group_to_ongoing (#108792)
Add select_related("project") to the Group queryset so that group.project access in the iteration loop doesn't trigger a separate query per group.
1 parent 3a721f0 commit 9e37c01

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/sentry/issues/ongoing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def bulk_transition_group_to_ongoing(
2424
# make sure we don't update the Group when its already updated by conditionally updating the Group
2525
groups_to_transistion = Group.objects.filter(
2626
id__in=group_ids, status=from_status, substatus=from_substatus
27-
)
27+
).select_related("project")
2828
span.set_tag("group_ids", group_ids)
2929
span.set_tag("groups_to_transistion count", len(groups_to_transistion))
3030

0 commit comments

Comments
 (0)