New answers tagged query-plan
The clustered index is partitioned on ReadTime so it couldn't use the PK as you describe. It would need to find the Max(Id) for each partition and then find the max of those. It is possible to rewrite the query to get such a plan however. Using an example based on the article here a possible rewrite might be SELECT MAX(ID) AS ID FROM sys.partitions AS P ...
Did you try to refresh your statistics? You can also try to use OPTION(RECOMPILE)on your query an recheck the actually used plan. Is it still the same? How fragmented is the clustered index?
Top 50 recent answers are included