Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id A0BF3B5DC4D for ; Tue, 12 Jul 2011 19:39:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 03399-07 for ; Tue, 12 Jul 2011 22:39:24 +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 3A255B5D944 for ; Tue, 12 Jul 2011 19:39:24 -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 p6CMdMtC018738; Tue, 12 Jul 2011 18:39:22 -0400 (EDT) To: Mario Splivalo cc: pgsql-performance@postgresql.org Subject: Re: Planner choosing NestedLoop, although it is slower... In-reply-to: <4E1CC576.2080200@megafon.hr> References: <4E1C8E62.2090800@megafon.hr> <4626.1310501052@sss.pgh.pa.us> <4E1CC576.2080200@megafon.hr> Comments: In-reply-to Mario Splivalo message dated "Wed, 13 Jul 2011 00:06:46 +0200" Date: Tue, 12 Jul 2011 18:39:22 -0400 Message-ID: <18737.1310510362@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: 201107/126 X-Sequence-Number: 44338 Mario Splivalo writes: > On 07/12/2011 10:04 PM, Tom Lane wrote: >> What you need to look into is why the estimated join size is 9400 rows >> when the actual join size is zero. Are both tables ANALYZEd? Are you >> intentionally selecting rows that have no join partners? > Yes, both tables have been ANALYZEd. What do you mean, intentilnaly > selecting rows taht have no join partners? I'm wondering why the actual join size is zero. That seems like a rather unexpected case for a query like this. regards, tom lane