I want to find the highest AutoIncremented value from a field. (its not being fetched after an insert where I can use @@SCOPE_IDENTITY
etc)
Which of these two q
If there is a clustered index there is virtually no difference in performance between the two queries.
This is becuase both will perform a Clustered Index Scan that will bear 100% of the query cost.
Performing the two queries on a column that does not have an index results in 3 operators being used in both execution plans.
The Top clause uses the Sort operator and the Max function uses a Stream Aggregate operator.
When there is no index, the MAX() function provides better performance.
Proof of concept can be found and full walkthrough of a test scenario can be found here:
Performance Comparison Top 1 Verses MAX() Function