Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 4B77E2E0079 for ; Tue, 27 May 2008 18:44:01 -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 70016-02 for ; Tue, 27 May 2008 18:43:25 -0300 (ADT) 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 developer.postgresql.org (Postfix) with ESMTP id C53012E006F for ; Tue, 27 May 2008 18:43:28 -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 m4RLhC1O014086; Tue, 27 May 2008 17:43:12 -0400 (EDT) To: Simon Riggs cc: pgsql-performance Subject: Re: Outer joins and equivalence In-reply-to: <1211918358.4489.257.camel@ebony.site> References: <1211918358.4489.257.camel@ebony.site> Comments: In-reply-to Simon Riggs message dated "Tue, 27 May 2008 20:59:18 +0100" Date: Tue, 27 May 2008 17:43:12 -0400 Message-ID: <14085.1211924592@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/350 X-Sequence-Number: 30318 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. regards, tom lane