Re: optimizing select ... not in (select ...)

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Laurent Martelli <laurent(at)aopsys(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: optimizing select ... not in (select ...)
Date: 2001-08-13 15:59:48
Message-ID: 200108131559.f7DFxmS19276@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Can it be redone using NOT EXISTS?

> I have this query :
>
> select distinct on (Pictures.PictureID) * from Pictures where Pictures.PictureID not in (select distinct PictureID from Keywords);
>
> and I find it a bit slow. Does anybody have suggestions to run this
> faster ? (I have indexes on PictureID on both Pictures and Keywords)
>
> --
> Laurent Martelli
> laurent(at)aopsys(dot)com http://www.bearteam.org/~laurent/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Laurent Martelli 2001-08-13 16:35:43 Re: optimizing select ... not in (select ...)
Previous Message Josh Berkus 2001-08-13 15:16:43 Re: optimizing select ... not in (select ...)