Dramatically improve dashboard query performance with relation columns.

Review Request #6490 — Created Oct. 22, 2014 and submitted — Latest diff uploaded

Information

Review Board
release-2.0.x
39cf866...

Reviewers

The "Target People", "Target Groups", and "To Me" columns each added one query
per row. This change adds some smarts to the database accesses. The "To Me"
column now caches all of the directly-assigned review requests into a list
which is stored in the datagrid state. The target people and target groups
columns now do a prefetch_related() to have only one additional query for the
column, rather than one per row.

  • Loaded the dashboard with all of these columns enabled. Before this change,
    for my particular set of review requests, it ran 29 queries in 25ms. After
    this change, the same dashboard ran with 11 queries in 12ms.
  • Ran unit tests.