Fix memory usage of update-db

This is really kind of a suboptimal way of doing it, but it's fast and
I'm tired of the problems with development environments taking a million
megabytes to compile S2.

I loosely tested this in my development environment. It's possible that
it breaks in some interesting way.