Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return just one record for each date
Message
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01484187
Message ID:
01484193
Views:
32
>Just curious (and this is almost in the "splitting hairs" department), have you ever looked at the execution plan when doing the (select top 1 order by date desc), versus the (select max(Orderdate) approach?

Yes, I guess I did. In the second article I posted execution plans and my results for simulation tests. From the common sense the ORDER BY may take longer than MAX, but in my tests ORDER BY was winning (for that particular test I was doing).

Also, in the comments to the first blog I list two long MSDN threads there I think we did performance testing as well.

I haven't re-visited the issue recently, but packed value solution usually wins performance wise.

Say, re-visited this thread now http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/824546a0-0c03-4af6-86c6-8df9f5381f2b and there ORDER BY solution was the slowest.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform