Skip to content

Commit 71cdf35

Browse files
authored
Force index only on list & stats (#4734)
Following up on #4731
1 parent d30d69b commit 71cdf35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

engine/apps/api/views/alert_group.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def get_queryset(self, ignore_filtering_by_available_teams=False):
332332
alert_receive_channels_ids = list(alert_receive_channels_qs.values_list("id", flat=True))
333333
queryset = AlertGroup.objects.filter(channel__in=alert_receive_channels_ids)
334334

335-
if settings.ALERT_GROUPS_DISABLE_PREFER_ORDERING_INDEX:
335+
if self.action in ("list", "stats") and settings.ALERT_GROUPS_DISABLE_PREFER_ORDERING_INDEX:
336336
# workaround related to MySQL "ORDER BY LIMIT Query Optimizer Bug"
337337
# read more: https://hackmysql.com/infamous-order-by-limit-query-optimizer-bug/
338338
from django_mysql.models import add_QuerySetMixin

0 commit comments

Comments
 (0)