August 22, 2012 at 1:10 pm
mtassin (8/22/2012)
GilaMonster (8/22/2012)
did I miss one that compared EXISTS/NOT EXISTS vs IN/NOT IN?
How would I compare things that do the complete opposite to each other?
EXISTS vs IN
NOT EXISTS vs NOT IN
Sorry, thought you were asking me to compare IN vs NOT IN and EXISTS vs NOT EXISTS (I've had stranger requests).
http://sqlinthewild.co.za/index.php/2009/08/17/exists-vs-in/
http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/
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/
http://sqlinthewild.co.za/index.php/2010/04/27/in-exists-and-join-a-roundup/
WHERE
EXISTS (select 1 from #Provider x where a.ProviderKey = x.id)
It's effectively very similar to the IN, but I've seen differences in performance between them myself. Maybe I'm just imagining things?
See first blog post linked above.
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
August 22, 2012 at 1:46 pm
Blah, what haven't you written?
Apparently I've had too many bad things taught to me.
I could swear that I've had performance differences between them, but that would have been at least one employer and 2-3 titles/positions ago. I don't even want to pull out a SQL Server 2000 install to setup some kind of test case to even see if my memory is correct or not. 🙂
Didn't see them in the first link you sent. But thanks...
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply