Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

perf(notebooks): defer content/text_content on notebooks list (#66278)

Julian Beza24a3a3ccf35
diff --git a/products/notebooks/backend/presentation/views/notebook.py b/products/notebooks/backend/presentation/views/notebook.py
index 9aeb9445ff9a..78119326f2ff 100644
--- a/products/notebooks/backend/presentation/views/notebook.py
+++ b/products/notebooks/backend/presentation/views/notebook.py
@@ -521,6 +521,10 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidD
if self.action == "list":
queryset = queryset.filter(deleted=False, visibility=Notebook.Visibility.DEFAULT)
queryset = self._filter_list_request(self.request, queryset)
+ # The list serializer omits content/text_content, but both are large columns
+ # (ProseMirror JSON + full plaintext) that we'd otherwise load and JSON-decode per row.
+ # search/contains filters run as WHERE-clause predicates, so they don't need the columns in Python.
+ queryset = queryset.defer("content", "text_content")
order = self.request.GET.get("order", None)
if order: