X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E61D832A611 for ; Fri, 22 Oct 2004 00:32:17 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08920-07 for ; Thu, 21 Oct 2004 23:32:13 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 61F0A32A927 for ; Fri, 22 Oct 2004 00:32:15 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i9LNWE7u012901; Thu, 21 Oct 2004 19:32:14 -0400 (EDT) To: Dmitry Tkach Cc: pgsql-sql Subject: Re: Trouble with explicit joins In-reply-to: <41783BC7.4040207@openratings.com> References: <41783BC7.4040207@openratings.com> Comments: In-reply-to Dmitry Tkach message dated "Thu, 21 Oct 2004 18:44:23 -0400" Date: Thu, 21 Oct 2004 19:32:13 -0400 Message-ID: <12900.1098401533@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/156 X-Sequence-Number: 19259 Dmitry Tkach writes: > I suppose, this is because the planner takes the order, in which the > tables appear in the explicit joins as some kind of a hint to how I want > that query to be executed, It's not a "hint", it's a requirement. In general, changing the order in which outer joins are executed changes the results. There are some cases in which it is safe to rearrange the order, but determining this takes close analysis of the join conditions, and we don't (yet) have any code to do that. So the planner must be conservative and take your join order as gospel. regards, tom lane