alphagov/transition — pull request #58 by rgarner (2013-11-06 15:12:38+00:00)
Title: Bring back Totals for hits

Hits and their summaries tend to perform badly because of the amount
of `SUM` activity going on (which precludes mySQL from using indices,
requiring instead a scan of a temporary table containing all the).

A `totals` table can help, but only for the summary/graphs. Nonetheless,
the performance is between 1.5x and 2x better for both summary and graphs.

It does come with the (cheap) responsibility of updating the totals table
whenever hits are updated. Since hits are updated through a single `rake`
task this shouldn't be onerous.