Re: IN() alternatives

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "John Smith" <john_smith_45678(at)yahoo(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: IN() alternatives
Date: 2003-02-05 21:12:01
Message-ID: D90A5A6C612A39408103E6ECDD77B8294CD8EA@voyager.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Unless the subquery is correlated, you can reformulate it as a join.

-----Original Message-----
From: John Smith [mailto:john_smith_45678(at)yahoo(dot)com]
Sent: Wednesday, February 05, 2003 1:03 PM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] IN() alternatives

I thought I saw a doc somewhere showing alternatives to using
IN() for better performance, but can't find it :(. Are there better
performing query alternatives to this?

delete from tab1 where id in (select id2 from tab2 where ...);

Where the subquery returns 1-10K's of records.

John



_____

Do you Yahoo!?
Yahoo! Mail Plus
<http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com> -
Powerful. Affordable. Sign up now
<http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2003-02-05 22:00:34 Re: not exactly a bug report, but surprising behaviour
Previous Message Oliver Elphick 2003-02-05 21:07:23 Re: [HACKERS] [ANNOUNCE] PostgreSQL v7.3.2 Released