Merge pull request #3385 from alphagov/improve-is_provider_slow-query

Improve query performance
This commit is contained in:
Rebecca Law
2021-12-01 11:41:51 +00:00
committed by GitHub

View File

@@ -558,6 +558,7 @@ def is_delivery_slow_for_providers(
ProviderDetails ProviderDetails
).outerjoin( ).outerjoin(
Notification, and_( Notification, and_(
Notification.notification_type == SMS_TYPE,
Notification.sent_by == ProviderDetails.identifier, Notification.sent_by == ProviderDetails.identifier,
Notification.created_at >= created_at, Notification.created_at >= created_at,
Notification.sent_at.isnot(None), Notification.sent_at.isnot(None),