Optimize the number of queries for the Diff Size column.
Review Request #718 — Created June 20, 2017 and updated
The Diff Size column was doing a query on the DiffSetHistory, latest DiffSet, and all FileDiffs for each and every review request. This wasn't great for performance. This change adds prefetching for the diffsets and filediffs, reducing the queries substantially. We still do need the filediffs, since total line counts aren't cached on the diffset (and even if they were, we'd still need to make the filediffs query for those not cached). It's still one of the more expensive columns, but far less than it used to be. Testing Done: Unit tests pass. Inspected the SQL statements for the datagrid. Saw that there were no longer large numbers of queries. Reviewed at https://reviews.reviewboard.org/r/8879/