Pooling database instances in database queue