Re: Postgresql sql query - selecting rows outside a join

From: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
To: Graham Leggett <minfrin(at)sharp(dot)fm>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgresql sql query - selecting rows outside a join
Date: 2003-12-01 17:34:07
Message-ID: Pine.LNX.4.44.0312011831590.31748-100000@kix.fsv.cvut.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

If you can, use PostgreSQL version 7.4. There is some optimalisation for
this questions. You can change your query from select .. IN (select) to
select .. exists (select). More about it you can find in FAQ.

regards
Pavel

On Mon, 1 Dec 2003, Graham Leggett wrote:

> Hi all,
>
> I am trying to do a query that returns all rows that are _not_ part of
> a join, and so far I cannot seem to find a query that doesn't take 30
> minutes or more to run.
>
> The basic query is "select * from tableA where tableA_id NOT IN (select
> tableA_id from tableB)".
>
> Is there a more efficient way of doing this?
>
> Regards,
> Graham
> --
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Toby Doig 2003-12-01 17:35:33 Re: Postgresql sql query - selecting rows outside a join
Previous Message Arjen van der Meijden 2003-12-01 17:32:22 Re: Postgresql sql query - selecting rows outside a join