Re: Bug in optimizer

Lists: pgsql-bugspgsql-performance
From: Timo Nentwig <timo(at)nitwit(dot)de>
To: support(at)postgresql(dot)org
Subject: Bug in optimizer
Date: 2004-05-03 16:08:23
Message-ID: 40966E77.4020004@nitwit.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-performance

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

Your bug report form on the web doesn't work.

This is very slow:

SELECT urls.id FROM urls WHERE
(
urls.id <> ALL (SELECT html.urlid FROM html)
);

...while this is quite fast:

SELECT urls.id FROM urls WHERE
(
NOT (EXISTS (SELECT html.urlid FROM tml WHERE
(
html.urlid = urls.id
)))
);

Regards
Timo
- --
http://nentwig.biz/ (J2EE)
http://nitwit.de/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAlm53cmRm71Um+e0RAkJuAKChd+6zoFesZfBY/cGRsSVagnJeswCeMD5s
++Es8hVsFlUpkIIsRfrBp4Y=
=STbS
-----END PGP SIGNATURE-----


From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Timo Nentwig <timo(at)nitwit(dot)de>
Cc: pgsql-performance(at)postgresql(dot)org, support(at)postgresql(dot)org
Subject: Re: Bug in optimizer
Date: 2004-05-04 16:36:19
Message-ID: 20040504163619.GB10698@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-performance

On Mon, May 03, 2004 at 18:08:23 +0200,
Timo Nentwig <timo(at)nitwit(dot)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
> )))
> );


From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Timo Nentwig <timo(at)nitwit(dot)de>
Subject: Re: Bug in optimizer
Date: 2004-05-05 17:31:01
Message-ID: 409924D5.1090001@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-performance

Timo Nentwig wrote:

> This is very slow:
>
> SELECT urls.id FROM urls WHERE
> (
> urls.id <> ALL (SELECT html.urlid FROM html)
> );
>
> ...while this is quite fast:
>
> SELECT urls.id FROM urls WHERE
> (
> NOT (EXISTS (SELECT html.urlid FROM tml WHERE
> (
> html.urlid = urls.id
> )))
> );

Are you using the version 7.4.x ?

Regards
Gaetano Mendola