Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 7A2642E007E for ; Mon, 2 Jun 2008 14:08:05 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 90425-04 for ; Mon, 2 Jun 2008 14:07:55 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail128162.authsmtp.com (outmail128162.authsmtp.com [62.13.128.162]) by developer.postgresql.org (Postfix) with ESMTP id 1BED02E0085 for ; Mon, 2 Jun 2008 14:07:55 -0300 (ADT) Received: from mail.authsmtp.com (mail.authsmtp.com [62.13.128.187]) by punt2.authsmtp.com (8.14.2/8.13.8/Kp) with ESMTP id m52H7qvO076521; Mon, 2 Jun 2008 18:07:52 +0100 (BST) Received: from [192.168.0.3] (85-211-65-92.dyn.gotadsl.co.uk [85.211.65.92]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m52H7kH9066264; Mon, 2 Jun 2008 18:07:46 +0100 (BST) Subject: Re: Outer joins and equivalence From: Simon Riggs To: Tom Lane Cc: pgsql-performance In-Reply-To: <14085.1211924592@sss.pgh.pa.us> References: <1211918358.4489.257.camel@ebony.site> <14085.1211924592@sss.pgh.pa.us> Content-Type: text/plain Date: Mon, 02 Jun 2008 18:10:44 +0100 Message-Id: <1212426644.4120.378.camel@ebony.site> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: 6c090f0e-30c6-11dd-8155-001185d377ca X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadBtFaAdbZ0xf HGQLW1xEUVV7WWR/ bwwfZQBDYEtPQQNv TkFLXVBXFgB3AVJc AxxmVUIKfgVAfnx2 YQhjXXRbEkIpdU99 FE4BCG4GNmF9aWFL BF1QdgZRbQNKfx5N bwR8U3ReMCtlM3Bw LDceBR4WBxBqYANI XgwXZVAVQEAQVjc6 S1gPBCguA0QBSiM4 InQn X-Authentic-SMTP: 61633235383639.squirrel.dmpriest.net.uk:1045/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200806/2 X-Sequence-Number: 30352 On Tue, 2008-05-27 at 17:43 -0400, Tom Lane wrote: > Simon Riggs writes: > > I have a complex query where making a small change to the SQL increases > > run-time by > 1000 times. > > > The first SQL statement is of the form > > > A JOIN B ON (a.id = b.id) LEFT JOIN C ON (a.id = c.id) > > > and the second is like this > > > A JOIN B ON (a.id = b.id) LEFT JOIN C ON (b.id = c.id) > > > the only difference is the substitution of a -> b > > Please provide an actual test case. Getting closer, but still not able to produce a moveable test case. Symptoms are * using partitioning * when none of the partitions are excluded * when equivalence classes ought to be able to reconcile join Still working on it -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support