Fix hit scope groupings

* No sloppy GROUP BYs
Increase work_mem to 16MB

* vital for HashAggregate to be used instead of slower GroupAggregate
Widen hits and hits_staging path column

* Would fall over on odd too-long rows from hits
Turn off quoting

* CDN files occasionally have unmatched quotes in the path
* Postgres doesn't allow disabling quoting when treating a file
  as CSV just to skip the header, so pretend the quote is an
  unprintable (E'\b' == backspace)
Use async commits

* Speeds up smaller transactions
* Returns before write-ahead log is persisted to disk
* Gives up the D (durability) in ACID - could result in data loss if the
  server crashed, but in the case of hits this would almost
  immediately be re-imported and in the case of bulk mapping
  adds would be repeatable.
Don't JOIN on a function loading hits

* Computed functions can't work against an index
Don't update hits_mappings_relations

* (that haven't changed)
Fix order-dependent test
Fix precompute_mapping_hit_counts for Postgres
Re-fix hits/mapping relations

* We'd changed the behaviour with the <>
* We need IS DISTINCT FROM to avoid three-valued logic
Optimise Import::HitsMappingsRelations

* Eschew path_hash join in favour of path
* precompute_mappings! only updates what's changed
Import::DailyHitTotals tweak

* Don't update what hasn't changed
Import::Hits - use IS DISTINCT FROM

* <> will give the wrong result and update too much. The impact is
  not bad data, but bad performance
Optimise hits indexes for postgres write

* Remove things killing write performance
* Add indices that will work
Fix order-dependent spec

* (again, was last fixed in 10230827ccbdaafe51a3e84f71875b73b9a99636 but that
   moved when import mappings arrived!)
Batch preview: make order explicit

* We depended on order(:id) implicitly but we can't rely on that working
  in Postgres. Make it explicit.
Make Postgres features not in schema.rb available

* We're only using this feature right now. If we use more, we'll need a
  better way of dealing with them. Switching to structure.sql can't and
  won't help.
Home page titles/furls in schema.rb

* While rebases from master are happening to this Postgres branch,
  we need to commit schema changes (as they're happening to
  structure.sql over there)
Fix Site#hit_total_count grouping
Fully qualify filter ordering