metadata: Don't populate lazy metadata in DB transactions

This will cause other threads accessing the metadb to stall
Improve metadata loading a bit by holding off queries...

... until more data is available