Handle initial db creation compare against the min db check, optimize logic to hit the DB fewer times.