Optimize the number of queries for the Diff Size column.

Review Request #8879 - Created April 6, 2017 and submitted

Christian Hammond
Review Board
release-2.0.x
f94080b...
reviewboard
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.

Unit tests pass.

Inspected the SQL statements for the datagrid. Saw that there were no
longer large numbers of queries.

David Trowbridge
Christian Hammond
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (93a43d3)
Loading...