On Mon, May 03, 2004 at 18:08:23 +0200,
Timo Nentwig <timo@nitwit.de> wrote:
>
> This is very slow:
This kind of question should be asked on the performance list.
>
> SELECT urls.id FROM urls WHERE
> (
> urls.id <> ALL (SELECT html.urlid FROM html)
> );
>
> ...while this is quite fast:
You didn't provide your postgres version or an explain analyze so it is hard
to answer your question definitivly. Most likely you are using a pre 7.4
version which is know to be slow for IN (which is what the above probably
gets translated to).
>
> SELECT urls.id FROM urls WHERE
> (
> NOT (EXISTS (SELECT html.urlid FROM tml WHERE
> (
> html.urlid = urls.id
> )))
> );