We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d4b9a17 commit 70d111dCopy full SHA for 70d111d
src/sentry/deletions/defaults/grouphistory.py
@@ -21,7 +21,14 @@ def chunk(self) -> bool:
21
return super().chunk()
22
23
for group_id in group_ids:
24
- # Delete all history records for a single group
25
- self.model.objects.filter(group_id=group_id).delete()
+ # Delete history records for a single group in chunks of 10000
+ queryset = self.model.objects.filter(group_id=group_id)
26
+ while True:
27
+ # Get IDs for the first 10000 records
28
+ chunk_ids = list(queryset.order_by("id").values_list("id", flat=True)[:10000])
29
+ if not chunk_ids:
30
+ break
31
+ # Delete records for these IDs
32
+ self.model.objects.filter(id__in=chunk_ids).delete()
33
34
return False
0 commit comments