Add database selection on pool, improve scheduler