From d8d9e77cfc8066fe1379e930f41f4643036d1aac Mon Sep 17 00:00:00 2001 From: Matti Eiden Date: Thu, 5 Sep 2024 08:49:31 +0300 Subject: [PATCH] perf: remove unnecessary qs distinct call When filtering using Exists() there is no risk of introducing duplicate rows. http://localhost:8000/v1/opening_hours/?data_source=tprek&start_date=0w &end_date=4w&page=3&page_size=10 Query time goes from 30-40 ms to <20 ms refs: HAUKI-647 --- hours/viewsets.py | 1 - 1 file changed, 1 deletion(-) diff --git a/hours/viewsets.py b/hours/viewsets.py index 5cf40066..bccbd05e 100644 --- a/hours/viewsets.py +++ b/hours/viewsets.py @@ -989,7 +989,6 @@ def get_queryset(self, start_date=None): ), ), ) - .distinct() .order_by("id") )