You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The performance optimization for MAX(instance_id) is subject to plan variation. Changing the OUTER APPLY to use TOP(1) instead of MAX should allow us to get the query plan we want more reliably.
The goal is for the query optimizer to seek on InstanceID within each partition, then perform a backward ordered scan to get the MAX instance_id for each partition very efficiently.
34
+
We then return the MAX across partitions. Older partitions could probably be skipped, but the cost of including them is small.
0 commit comments