Implement query execution