Re: not exists clause

From: Guy Rouillier <guyr-ml1(at)burntmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: not exists clause
Date: 2008-01-11 04:00:23
Message-ID: 4786E9D7.10003@burntmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

S Golly wrote:
> I cannot get the "not exists" clause of ANSI SQL to execute correctly.
> select t.col11, t.col1... from table1 t where not exists (select 1 from
> table2 where col2 = t.col1);
> table1 has 40M + rows. if that matters.
>
> OS is FreeBSD 6.2, postgresql version 8.2.6
>
> Is it not supported or a bug ?
> thank you for your support.

This is really not a performance question, but a general SQL question.

select * from t1

f1
--
1
2
3

select * from t2

f1
--
1
2

select * from t1
where not exists
(
select 1
from t2
where t2.f1 = t1.f1
)

f1
--
3

--
Guy Rouillier

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Pomarede Nicolas 2008-01-11 09:31:26 Re: Best way to index IP data?
Previous Message Jonah H. Harris 2008-01-10 23:41:56 Re: Best way to index IP data?