implement query task from DB.