Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
danasegarane76
Posting Yak Master
242 Posts |
Posted - 2007-06-05 : 04:47:33
|
| Hi all, I was told by my boss that , you should not use distinct ,use group by.Because distinct will take some resourcesThnks in AdvanceDana |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-06-05 : 04:51:04
|
| Run two queries, onw with DISTINCT and one with GROUP BY.Compare the two execution/query plans.Peter LarssonHelsingborg, Sweden |
 |
|
|
danasegarane76
Posting Yak Master
242 Posts |
Posted - 2007-06-05 : 04:57:14
|
| Dear Perter, Thanks for your reply. I run the same qry. It have the same result as Select Cost = 0% Sort distinct Sort=23% Table cost = 77%No difference .Then why did he say like that ? |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-05 : 05:10:18
|
| Read this: [url]http://msmvps.com/blogs/robfarley/archive/2007/03/24/group-by-v-distinct-group-by-wins.aspx[/url]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
danasegarane76
Posting Yak Master
242 Posts |
Posted - 2007-06-05 : 05:36:07
|
Thanks Harsh |
 |
|
|
|
|
|