August 14, 2012 at 4:50 am
Just read this on the net, seems very staright forward and simple.
Anyone with any different views?
When a clustered index is present on the table & column that is to be selected, both the MAX() operator and the query (SELECT TOP 1 ColumnName order by ColumnName) have almost identical performance.
When there is no clustered index on the table & column to be queried, the MAX() operator offers the better performance.
I hope you enjoyed the article and please feel free to post any comments, questions and feedback below.
August 14, 2012 at 6:07 am
Can you post a URL to the article? I've just checked it on 2 tables and get 2 query plans with almost the same cost. Maybe there is some more information, but from what I know, and from my very little test, it doesn't seem to be true.
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
August 14, 2012 at 8:46 am
August 14, 2012 at 8:56 am
This way is easier for everyone
http://www.johnsansom.com/performance-comparison-of-select-top-1-verses-max/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply