Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 186A19FA435 for ; Wed, 10 Jan 2007 14:42:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 31048-04 for ; Wed, 10 Jan 2007 14:42:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from out5.smtp.messagingengine.com (out5.smtp.messagingengine.com [66.111.4.29]) by postgresql.org (Postfix) with ESMTP id E09E59FA344 for ; Wed, 10 Jan 2007 14:42:15 -0400 (AST) Received: from out1.internal (unknown [10.202.2.149]) by out1.messagingengine.com (Postfix) with ESMTP id DAC5E753B2; Wed, 10 Jan 2007 13:38:24 -0500 (EST) Received: from web2.messagingengine.com ([10.202.2.211]) by out1.internal (MEProxy); Wed, 10 Jan 2007 13:38:24 -0500 Received: by web2.messagingengine.com (Postfix, from userid 99) id BDDD01F723; Wed, 10 Jan 2007 13:38:24 -0500 (EST) Message-Id: <1168454304.25047.1168597535@webmail.messagingengine.com> X-Sasl-Enc: dWo+xDOuWkNpn+5PxdWwozTKL+NB582m73lA+d7jv8Ct 1168454304 From: "Jeremy Haile" To: "Tom Lane" Cc: pgsql-performance@postgresql.org Content-Disposition: inline Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="ISO-8859-1" MIME-Version: 1.0 X-Mailer: MessagingEngine.com Webmail Interface References: <1168445842.5566.1168570133@webmail.messagingengine.com> <10060.1168449344@sss.pgh.pa.us> <1168453218.22654.1168592237@webmail.messagingengine.com> <14865.1168454295@sss.pgh.pa.us> Subject: Re: Slow inner join, but left join is fast In-Reply-To: <14865.1168454295@sss.pgh.pa.us> Date: Wed, 10 Jan 2007 13:38:24 -0500 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/136 X-Sequence-Number: 22737 I'm pretty sure it didn't analyze in between - autovac is turned off and I ran the test multiple times before posting. But since I can't reproduce it anymore, I can't be 100% sure. And it certainly doesn't make sense that the estimate for the index scan would change based on an unrelated join condition. If I ever get it to happen again, I'll be more careful and repost if it is a real issue. Thanks for pointing me in the right direction! On Wed, 10 Jan 2007 13:38:15 -0500, "Tom Lane" said: > "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