March 24, 2013 at 9:24 pm
I have a query where sort is done at the end on different columns from 3 different databases. I see that in the execution plan most of the cost is around the sort , if all these columns were in one db i could have added as part of index but how this work when sort is done on multiple columns from different dbs? Sample code is below
GROUP BY Db1.UserName,
Db1.Email,
Db2.LocationID,
Db3.[Name]
March 25, 2013 at 1:14 am
I think there's something missing from your sample code.
In short, you can't really reduce the cost, sorts are expensive operations, if you need a sorted resultset, you have to accept the cost of sorting. With adequate memory and optimised TempDB, you may be able to reduce the time required to do the sort though.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply