:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(alerts): prefetch related rows in alert list queryset (#60714)
Matt Pua3a05d3ed07a8
diff --git a/products/alerts/backend/api/alert.py b/products/alerts/backend/api/alert.pyindex feb2f0c7fe19..fa669e6517db 100644--- a/products/alerts/backend/api/alert.py+++ b/products/alerts/backend/api/alert.py@@ -691,7 +691,11 @@ class AlertSimulateResponseSerializer(serializers.Serializer):class AlertViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):scope_object = "alert"- queryset = AlertConfiguration.objects.select_related("team", "insight").order_by("-created_at")+ queryset = (+ AlertConfiguration.objects.select_related("team", "insight", "threshold", "created_by")+ .prefetch_related("subscribed_users")+ .order_by("-created_at")+ )serializer_class = AlertSerializerdef safely_get_queryset(self, queryset) -> QuerySet: