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 |
|
etietje
Starting Member
24 Posts |
Posted - 2005-04-12 : 11:16:22
|
| Hello everybody. I have a question. In my last job I researched some SQL optimization techniques. One of the things I found was to never use Select DISTINCT in an inner select statement. For example never do this: select * from table where xcol in (select DISTINCT xcol from table2)The reasoning was that in order to do a distinct the server already has to have all the records and it is unnecessary overhead. But I've also heard that SQL automatically optimizes the select so the DISTINCT isn't used.My question: Is this true? I've looked at some execution plans based on with DISTINCT and without and they are identical. But is that conclusive enough? Does anybody know the truth about this?Thanks a lot. |
|
|
|
|
|