Stale query optimization