Removing cache in view and improving query