Some DB tweaks for improved performance

- Tweak wal_autocheckpoint depending on whether we're running scanner or
server code. Scan is heavy on writes. Using a larger checkpoint interval
can greatly improve scan performance on slow disk systems.
- Move db configuration into DbCache base class to allow all cache
classes to use the highmem settings.