Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 67CE6B5F833 for ; Mon, 6 Jun 2011 21:09:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 07817-06 for ; Tue, 7 Jun 2011 00:09:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 2EC1EB5DD07 for ; Mon, 6 Jun 2011 21:09:40 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p5709eHq016103; Mon, 6 Jun 2011 20:09:40 -0400 (EDT) To: Craig Ringer cc: mark , pgsql-performance@postgresql.org Subject: Re: not exits slow compared to not in. (nested loops killing me) In-reply-to: <4DED5DB5.4030309@postnewspapers.com.au> References: <4DED5DB5.4030309@postnewspapers.com.au> Comments: In-reply-to Craig Ringer message dated "Tue, 07 Jun 2011 07:07:33 +0800" Date: Mon, 06 Jun 2011 20:09:40 -0400 Message-ID: <16102.1307405380@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/41 X-Sequence-Number: 43974 Craig Ringer writes: > On 06/07/2011 04:38 AM, mark wrote: > Hash Anti Join (cost=443572.19..790776.84 rows=1 width=1560) > (actual time=16337.711..50358.487 rows=2196299 loops=1) > Note the estimated vs actual rows. Either your stats are completely > ridiculous, or the planner is confused. The latter ... I think the OP is hurting for lack of this 9.0.4 fix: http://git.postgresql.org/gitweb?p=postgresql.git&a=commitdiff&h=159c47dc7170110a39f8a16b1d0b7811f5556f87 regards, tom lane