Reduce profile queries in the datagrids.
Review Request #8875 — Created April 5, 2017 and submitted — Latest diff uploaded
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, andget_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 usingselect_related()
or looked up using the field
relation, we can callget_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.