Reduce profile queries in the datagrids.

Review Request #8875 — Created April 5, 2017 and submitted — Latest diff uploaded

Information

Review Board
release-3.0.x
4606180...

Reviewers

The introduction of avatar support caused performance degradations in
the datagrids due to the way profiles are fetched. Every entry had a
get_profile() call, which performed a database lookup, which made the
dashboard and other datagrids very slow.

To solve this, the columns now do a select_related() on the profile
field, and get_profile() has been updated to reuse the same caching
variable that's populated for the relation. This means that if a profile
is ever included using select_related() or looked up using the field
relation, we can call get_profile() without performing an additional
lookup.

Verified that the dashboard, All Review Requests, and user pages no
longer have a profile query per datagrid entry.

Unit tests pass.

    Loading...