Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id B76EE9FA344 for ; Wed, 10 Jan 2007 14:38:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 01805-01 for ; Wed, 10 Jan 2007 14:38:11 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 71BD49FA354 for ; Wed, 10 Jan 2007 14:38:18 -0400 (AST) 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 l0AIcGKF014866; Wed, 10 Jan 2007 13:38:16 -0500 (EST) To: "Jeremy Haile" cc: pgsql-performance@postgresql.org Subject: Re: Slow inner join, but left join is fast In-reply-to: <1168453218.22654.1168592237@webmail.messagingengine.com> References: <1168445842.5566.1168570133@webmail.messagingengine.com> <10060.1168449344@sss.pgh.pa.us> <1168453218.22654.1168592237@webmail.messagingengine.com> Comments: In-reply-to "Jeremy Haile" message dated "Wed, 10 Jan 2007 13:20:18 -0500" Date: Wed, 10 Jan 2007 13:38:15 -0500 Message-ID: <14865.1168454295@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/135 X-Sequence-Number: 22736 "Jeremy Haile" writes: > I still don't understand why the inner join would be so different from > the left join prior to the analyze. Are you sure you hadn't analyzed in between? Or maybe autovac did it for you? The reason for the plan change is the change from estimating 1 row matching the transaction_date range constraint, to estimating lots of them, and the join type away up at the top would surely not have affected that. regards, tom lane