diff --git a/src/pretix/base/models/checkin.py b/src/pretix/base/models/checkin.py index 78c859f00..18fed1c62 100644 --- a/src/pretix/base/models/checkin.py +++ b/src/pretix/base/models/checkin.py @@ -3,7 +3,7 @@ from django.db import models from django.db.models import Exists, F, Max, OuterRef, Q, Subquery from django.utils.timezone import now from django.utils.translation import gettext_lazy as _, pgettext_lazy -from django_scopes import ScopedManager +from django_scopes import ScopedManager, scopes_disabled from jsonfallback.fields import FallbackJSONField from pretix.base.models import LoggedModel @@ -90,6 +90,9 @@ class CheckinList(LoggedModel): ).count() @property + @scopes_disabled() + # Disable scopes, because this query is safe and the additional organizer filter in the EXISTS() subquery tricks PostgreSQL into a bad + # subplan that sequentially scans all events def checkin_count(self): return self.event.cache.get_or_set( 'checkin_list_{}_checkin_count'.format(self.pk),