Compromise hits indices to balance import performance

Compromise indices to make import/view hits work after discovery of
very bad index selection on 9.1 in Preview (blocking single hit file imports
on a single query taking > 20mins). This is an admission that
we don't know what's gone wrong in Preview but we know how to fix it.
Preview doesn't select the "bad" import index when it isn't there, and hits view
can use these two in concert.

We don't know that 9.1 caused this, because it wasn't happening in dev
on 9.1, so we're assuming an environmental difference. We don't know
whether that environmental difference will affect 9.3.x in the same way.
We should try reverting to the two 3/4-column index solution on 9.3.x
later by reverting or erasing this commit.

This is less than ideal because we know extra indices slows import down.
On the plus side it speeds up the viewing of hits (particularly for
summary/category) by around 100%.
Ensure db/schema at latest
Temporarily boost maintenance_work_mem

Not something we'd normally do, but our mySQL->Postgres conversion job has a
lot of indexing in following migrations. Make sure these are not choking
on lack of memory.

We'll also need to up this amount in the psql load job via PGOPTIONS.
Specify the ordering of the bulk add preview "first 20 mappings"

- The bulk add preview page shows the first 20 mappings, but the
  ordering wasn't set so potentially mappings /a, /b, /c could have
  ended up as /a, /c, /b in the preview. This fixes that bug by
  specifying the ordering as in
  https://github.com/alphagov/transition/blob/postgres-master/app/presenters/batch_preview_presenter.rb#L23.
Fix sort order on leaderboard

* Nulls were appearing first in the errors column
* Make them appear last
* That's it
Move data access to the controller

* index.html.erb was calling ActiveRecord directly
Remove ".0" from integer leaderboard numbers

* For some reason, Postgres gives us a floating point column for an integer sum.
  Be explicit that this is not supposed to be the case by casting to ::integer
  in the sum/count parts of the leaderboard query