X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7AA5DD1E0DE for ; Tue, 4 May 2004 13:32:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 36914-10 for ; Tue, 4 May 2004 13:31:51 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 327CAD1F07D for ; Tue, 4 May 2004 13:31:50 -0300 (ADT) Received: (qmail 10987 invoked by uid 500); 4 May 2004 16:36:19 -0000 Date: Tue, 4 May 2004 11:36:19 -0500 From: Bruno Wolff III To: Timo Nentwig Cc: pgsql-performance@postgresql.org, support@postgresql.org Subject: Re: Bug in optimizer Message-ID: <20040504163619.GB10698@wolff.to> Mail-Followup-To: pgsql-performance@postgresql.org, bruno@wolff.to References: <40966E77.4020004@nitwit.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40966E77.4020004@nitwit.de> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/25 X-Sequence-Number: 6856 On Mon, May 03, 2004 at 18:08:23 +0200, Timo Nentwig 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 > ))) > );