Re: IN() alternatives

From: Andrew Sullivan <andrew(at)libertyrms(dot)info>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: IN() alternatives
Date: 2003-02-05 22:54:49
Message-ID: 20030205175449.P19037@mail.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 05, 2003 at 01:02:53PM -0800, John Smith wrote:
>
> 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 ...);

Depending on what you're doing, postgres has an extension of SQL

DELETE FROM tab1 WHERE id=tab2.id2 AND tab2.somefield [some
condition].

At least, this has worked for me.

A

--
----
Andrew Sullivan 204-4141 Yonge Street
Liberty RMS Toronto, Ontario Canada
<andrew(at)libertyrms(dot)info> M2P 2A8
+1 416 646 3304 x110

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2003-02-05 23:32:46 Re: not exactly a bug report, but surprising behaviour
Previous Message Arjen van der Meijden 2003-02-05 22:18:56 Re: IN() alternatives