[PATCH v3 0/7] Add series support
dja at axtens.net
Thu Sep 15 19:31:35 AEST 2016
> This series causes a > 2x jump in the number of SQL queries required to
> display the front page. With my test of some emails from the patchwork
> mailing list, it goes from 73 queries on master to 182 queries, and the
> time spent in SQL also more than doubles.
> That's highly problematic.
> We need to debug and fix this before merging. I'm currently
> investigating, but if you have any insights that would be great.
Here's a fix. This plus my other patch for checks has the front page
stable at 10 queries. Haven't checked Django 1.10 compat.
diff --git a/patchwork/views/__init__.py b/patchwork/views/__init__.py
index 008c629b9398..f7aacdb63bc9 100644
@@ -291,9 +291,10 @@ def generic_list(request, project, view, view_args=None, filter_settings=None,
# fields that can potentially contain a lot of data
patches = patches.defer('content', 'diff', 'headers')
- # but we will need to follow the state and submitter relations for
+ # but we will need to follow a number of relations for
# rendering the list template
- patches = patches.select_related('state', 'submitter', 'delegate')
+ patches = patches.select_related('state', 'submitter', 'delegate',
+ 'series', 'series__cover_letter')
# we also need checks
patches = patches.prefetch_related('check_set')
More information about the Patchwork