Skip to content

Commit

Permalink
Move qs.difference after other filters since they are not applied o…
Browse files Browse the repository at this point in the history
…therwise
  • Loading branch information
Ubuntu committed Aug 10, 2021
1 parent 455cc40 commit d907a3a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main/rest/_annotation_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ def _get_annotation_psql_queryset(project, filter_ops, params, annotation_type):
if after is not None:
qs = qs.filter(pk__gt=after)

if exclude_parents:
parent_set = Localization.objects.filter(pk__in=Subquery(qs.values('parent')))
qs = qs.difference(parent_set)

# TODO: Remove modified parameter
qs = qs.exclude(modified=False)

qs = get_attribute_psql_queryset(qs, params, filter_ops)

if exclude_parents:
parent_set = Localization.objects.filter(pk__in=Subquery(qs.values('parent')))
qs = qs.difference(parent_set)

# Coalesce is a no-op that prevents PSQL from using the primary key index for small
# LIMIT values (which results in slow queries).
if exclude_parents or (stop is None):
Expand Down

0 comments on commit d907a3a

Please sign in to comment.