Reduce profile queries in the datagrids.
Review Request #8875 — Created April 5, 2017 and submitted
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.
Description | From | Last Updated |
---|---|---|
Typo in description: "very slo" |
david |
- Description:
-
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 slo. ~ dashboard and other datagrids very slow. To solve this, the columns now do a
select_related()
on the profilefield, and get_profile()
has been updated to reuse the same cachingvariable that's populated for the relation. This means that if a profile is ever included using select_related()
or looked up using the fieldrelation, we can call get_profile()
without performing an additionallookup.