Skip to content

Commit

Permalink
Force index only on list & stats (#4734)
Browse files Browse the repository at this point in the history
Following up on #4731
  • Loading branch information
vadimkerr authored Jul 25, 2024
1 parent d30d69b commit 71cdf35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion engine/apps/api/views/alert_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def get_queryset(self, ignore_filtering_by_available_teams=False):
alert_receive_channels_ids = list(alert_receive_channels_qs.values_list("id", flat=True))
queryset = AlertGroup.objects.filter(channel__in=alert_receive_channels_ids)

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

0 comments on commit 71cdf35

Please sign in to comment.