Using the IN clauise

From: terry(at)greatgulfhomes(dot)com
To: "Postgres (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Using the IN clauise
Date: 2002-10-25 18:37:56
Message-ID: 000001c27c55$a3840d80$2766f30a@development.greatgulfhomes.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I thought I read somewhere that it was better to avoid using the IN clause
(at least when that means doing a subselect) for efficiency reasons, but I
cannot find it on the website now.

Does anyone know where that is?

And can someone confirm the following:

This:
SELECT t1.f1
FROM t1
WHERE t1.f1 IN (select f1 from t2 AS t2 where t2.f1 = t1.f1 AND t2.f2 =
'v1')

is generally slower to run then:
SELECT t1.f1
FROM t1, t2
WHERE t1.f1 = t2.f1
AND t2.f3 = 'v1'

Thanks

Terry Fielder
Network Engineer
Great Gulf Homes / Ashton Woods Homes
terry(at)greatgulfhomes(dot)com

Browse pgsql-general by date

  From Date Subject
Next Message terry 2002-10-25 18:40:00 Re: Using the IN clauise
Previous Message Stephan Szabo 2002-10-25 18:17:08 Re: question about seq scan and index scan