X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id B774F9FB339 for ; Mon, 31 Jul 2006 09:54:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 84994-06 for ; Mon, 31 Jul 2006 09:54:31 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 8F6A29FB335 for ; Mon, 31 Jul 2006 09:53:46 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6VCrYZN013709; Mon, 31 Jul 2006 08:53:34 -0400 (EDT) To: Rod Taylor cc: H Hale , pgsql-performance@postgresql.org Subject: Re: sub select performance due to seq scans In-reply-to: <1154347782.24186.278.camel@home> References: <20060731015014.87910.qmail@web88005.mail.re2.yahoo.com> <1154347782.24186.278.camel@home> Comments: In-reply-to Rod Taylor message dated "Mon, 31 Jul 2006 08:09:42 -0400" Date: Mon, 31 Jul 2006 08:53:34 -0400 Message-ID: <13708.1154350414@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.033 tagged_above=0 required=5 tests=AWL, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL X-Spam-Level: ** X-Archive-Number: 200607/307 X-Sequence-Number: 20167 Rod Taylor writes: >> Nested Loop IN Join (cost=0.00..1386.45 rows=5809 width=14) (actual >> time=2.933..101467.463 rows=5841 loops=1) >> Join Filter: ("outer".objectid = "inner".dstobj) >> -> Seq Scan on flatomfilesysentry (cost=0.00..368.09 rows=5809 >> width=30) (actual time=0.007..23.451 rows=5844 loops=1) >> -> Seq Scan on flatommemberrelation (cost=0.00..439.05 rows=5842 >> width=16) (actual time=0.007..11.790 rows=2922 loops=5844) > A loop for an IN indicates that you are using a very old version of > PostgreSQL (7.2 or earlier). No, it's not that, because 7.2 certainly had no idea of "IN Join"s. But there's something mighty fishy about this plan anyway. The planner was predicting 5809 rows out from flatomfilesysentry (not too far off), so why didn't it predict something north of 368.09 + 5809 * 439.05 as the total join cost? There's a special case in cost_nestloop for IN joins, but it sure shouldn't have reduced the estimate by a factor of 1800+ ... regards, tom lane