Avoid too many User queries when calculating ReviewRequestPageData state.
Review Request #14316 — Created Jan. 30, 2025 and updated
We query a lot of objects in
ReviewRequestPageData
, and many of these
haveUser
objects associated. These end up being queried as separate
instances, which means that we lose out on any caching of profiles. This
ultimately leads to a lot of extra SQL queries per page.We now determine all the users we know we have up-front, and then query
for for anything we're missing. Once we know we have all the users, we
re-attach the instances to the fetched objects, allowing the same
instances and cached state to be reused.
Unit tests pass.
Verified that the SQL queries on some test review requests have been
reduced.
Summary | ID |
---|---|
6a5049fa4e2b6c3cfc3977254a9da178253945bf |