From a40858adbf3b172cf016df9bf169c6a6510c72da Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Fri, 7 Apr 2023 20:21:22 +0000 Subject: [PATCH] optimize query --- .../agents/management/commands/bulk_delete_agents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/tacticalrmm/agents/management/commands/bulk_delete_agents.py b/api/tacticalrmm/agents/management/commands/bulk_delete_agents.py index 74d22d0f..85b1ba88 100644 --- a/api/tacticalrmm/agents/management/commands/bulk_delete_agents.py +++ b/api/tacticalrmm/agents/management/commands/bulk_delete_agents.py @@ -60,7 +60,7 @@ class Command(BaseCommand): ) return - agents = Agent.objects.defer(*AGENT_DEFER) + agents = Agent.objects.select_related("site__client").defer(*AGENT_DEFER) if days: overdue = djangotime.now() - djangotime.timedelta(days=days)