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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Optimization

Author  Topic 

Ranjit.ileni
Posting Yak Master

183 Posts

Posted - 2011-07-19 : 03:12:25
Hi ,

I prepared same query in following 3 ways

1) using NOT IN
2) using LEFT JOIN WITH NULL
3) using NOT EXISTS

then the Query cost is same i.e., 33%,33%,33%

at last Performance wise which method i should use in Real Time.

Need Suggestions .

Thanks ,



--Ranjit

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2011-07-19 : 03:15:45
http://connectsql.blogspot.com/2011/05/sql-server-which-performs-better-in-or.html

Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-07-19 : 04:19:40
http://sqlinthewild.co.za/index.php/2010/02/18/not-exists-vs-not-in/
http://sqlinthewild.co.za/index.php/2010/03/23/left-outer-join-vs-not-exists/

--
Gail Shaw
SQL Server MVP
Go to Top of Page

Ranjit.ileni
Posting Yak Master

183 Posts

Posted - 2011-07-19 : 06:05:58
Nice articles...

My choice NOT EXISTS

--Ranjit
Go to Top of Page
   

- Advertisement -