Reduce SQL queries in the review request page.

Review Request #8996 — Created June 5, 2017 and submitted

Information

Review Board
release-3.0.x
a28c4f8...

Reviewers

There were some regressions in the performance of the review request
page. Each review ended up causing a new SQL query for the status
updates, and every review also caused SQL queries for profiles for
avatars. There were also queries for reviews from the status updates,
since the two weren't linked up, and queries for the review on each
comment, since that link was also missing.

This fixes those by linking up those objects and ensuring query caches
are properly set. It should cause the SQL query counts to be back at a
stable number not impacted by the number of users, reviews, or replies.

Checked the SQL queries before and after with large review requests.
Saw that the counts dropped to more reasonable numbers (though still
large, given what's needed for the page) that seemed stable for
review requests of different sizes.

david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (353cc34)