From 78025df40579ccf022b428d48982b664f476ee0a Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 25 Aug 2026 14:35:22 -0700 Subject: [PATCH] Performance: fetch note authors with prefetch instead of one query each (#13790) --- src/documents/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/documents/views.py b/src/documents/views.py index 0d3f9de99..29cde306b 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -1133,7 +1133,8 @@ class DocumentViewSet( "custom_fields", queryset=CustomFieldInstance.objects.select_related("field"), ), - "notes", + # NotesSerializer nests the author, this avoids query per note + Prefetch("notes", queryset=Note.objects.select_related("user")), ) )