July 22, 2004 at 11:47 am
Hi.
Exists can be used instead of an inner join, an IN, an ANY subquery and probably other things too. If there are two ways to do the same thing in T-SQL, is there a better (more optimal) way? Is it Exists()?
Thanks,
July 22, 2004 at 12:14 pm
There is no right answer to that. You have to know your data. Except on some trivial situations your best bet is to check the execution plan, CPU Utilization, Indexes and IO Overhead. Then you will be really in shape to know the answer
* Noel
July 23, 2004 at 2:08 am
For simple cases the db engine might well build the same execution plan for two syntactically different T-SQL statements that arae semantically equivalent. But in general it takes experimentation with various re-workings of the same statement, knowledge of the data, knowledge of indexes, examination of execution plans, and plain old experience to judge what the best way to phrase some T-SQL is.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply