Improve speed by batching inserts and using a separate DB as node cache.

The node cache database can later be dropped to save on space too.