From 2f637466c2d1b6add63cbe7db02b71f02169b804 Mon Sep 17 00:00:00 2001 From: nikolas Date: Wed, 8 Jan 2025 11:15:01 -0500 Subject: [PATCH] Remove prefetch_related on collaboration call In development mode, removing this prefetch increases both the SQL queries and CPU load, but for some reason allows the page to actually load in the staging environment. So, I want to deploy this to see if it changes anything in production. --- structuredcollaboration/models.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/structuredcollaboration/models.py b/structuredcollaboration/models.py index 119f1196a..96a2e3fcf 100644 --- a/structuredcollaboration/models.py +++ b/structuredcollaboration/models.py @@ -128,13 +128,7 @@ def get_children_for_object(self, obj, author=None): if author and not author.is_anonymous: queryset = queryset.filter(Q(user=author) | Q(group__user=author)) - return queryset.select_related( - 'user', 'group', 'policy_record' - ).prefetch_related( - 'content_object', - 'content_object__author', - 'content_object__participants', - 'content_object__collaboration') + return queryset.select_related('user', 'group', 'policy_record') def get_top_ancestor(self): # i.e. domain result = self