Initial db query system