From 3830f31c0e7310287dd87804258af26c63974511 Mon Sep 17 00:00:00 2001 From: Deimos Date: Tue, 14 Jan 2020 16:04:41 -0700 Subject: [PATCH] Improve performance of excluding ignored topics This generates a significantly better execution plan for the query - I think using one of the columns from the join condition helps the query-planner do this properly. --- tildes/tildes/models/topic/topic_query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tildes/tildes/models/topic/topic_query.py b/tildes/tildes/models/topic/topic_query.py index 39bb045..d14dc95 100644 --- a/tildes/tildes/models/topic/topic_query.py +++ b/tildes/tildes/models/topic/topic_query.py @@ -60,7 +60,7 @@ class TopicQuery(PaginatedQuery): self = super()._finalize() if self.filter_ignored: - self = self.filter(TopicIgnore.created_time == None) # noqa + self = self.filter(TopicIgnore.topic_id == None) # noqa return self