Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > IN vs EXISTS
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 15768 of 17437
Post > Topic >>

IN vs EXISTS

by askel <dummy666@[EMAIL PROTECTED] > Jun 6, 2008 at 08:58 PM

Hi all,

I have been using IN clause almost exclusively until recently I tried
to use EXISTS and gained significant performance increase without
changing/creating any indexes:

SELECT ... FROM a WHERE a.ref IN (SELECT b.id WHERE ...)

vs

SELECT ... FROM a WHERE EXISTS (SELECT 1 FROM b WHERE a.ref=b.id ...)

Performance is at least few times better when EXISTS is used. Is it
just PostgreSQL specific?

Cheers
 




 4 Posts in Topic:
IN vs EXISTS
askel <dummy666@[EMAIL  2008-06-06 20:58:26 
Re: IN vs EXISTS
tgl@[EMAIL PROTECTED] (T  2008-06-07 11:19:10 
Re: IN vs EXISTS
askel <dummy666@[EMAIL  2008-06-09 07:14:59 
Re: IN vs EXISTS
pgsql@[EMAIL PROTECTED]   2008-06-12 10:14:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 15:59:49 CST 2008.