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 8E1C852B45 for ; Mon, 15 Aug 2005 13:34:39 -0300 (ADT) 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 54967-05 for ; Mon, 15 Aug 2005 16:34:37 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.193]) by svr1.postgresql.org (Postfix) with ESMTP id E808A52AA3 for ; Mon, 15 Aug 2005 13:34:34 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id z6so689083nzd for ; Mon, 15 Aug 2005 09:34:33 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=p309+S4n85NyJv/5prd4w9p2uFVy+0kQLIBfPnH3fRjzVKqPs3cmPKjEpQNViT1pgolaDr0P/6OzJw8Sr8tbALqDA2+6Aj90mVnEyyvDgQ8g5U5/sxtk0+yX+iIvzfZZw/dVkCRU++Js+5O8Lp6sL8vrHCnLkUQ1+nSjRDGqBvg= Received: by 10.36.81.19 with SMTP id e19mr1959427nzb; Mon, 15 Aug 2005 09:34:33 -0700 (PDT) Received: by 10.36.224.9 with HTTP; Mon, 15 Aug 2005 09:34:32 -0700 (PDT) Message-ID: <3d104d6f05081509345067d83b@mail.gmail.com> Date: Mon, 15 Aug 2005 11:34:32 -0500 From: Dario Bahena Tapia To: Stephan Szabo Subject: Re: Parentheses in FROM clause and evaluation order. Cc: pgsql-sql@postgresql.org In-Reply-To: <20050815065906.K33261@megazone.bigpanda.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200508110042.j7B0g1TZ015835@panselmo.fciencias.unam.mx> <20050815065906.K33261@megazone.bigpanda.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 required=5 tests=[RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200508/160 X-Sequence-Number: 22387 Hi, The final result seems to be the same, I just was curious about the standard behavior. Does the SQl says something about this execution order? Thanks for your response. salu2 dario estepario ... 2005/8/15, Stephan Szabo : > On Wed, 10 Aug 2005 dario.mx@gmail.com wrote: >=20 > > I thought that the parenthesis in the table expression > > (FROM clause), could be used to indicate the desired > > evaluation order. But, I tried with a couple of samples > > and the explain command returned me the same result; no matter > > what parentheses association I used. I am using only INNER JOINs. > > > > In fact, I thought that the whole table expression was gonna be > > evaluated before the WHERE filter. Does the stantard says something > > about this evaluation order when the parentheses are present? > > Does PostgreSQL implements this behavior? >=20 > AFAIK we only try to provide final results that are equivalent to > following the steps in order, so it'll reorder joins or push clauses > around as long as it thinks the semantics of the query won't change. For > example, actually doing unconstrainted joins before where clauses is a > very bad plan if you've got a FROM table1, table2, table3 style query. If > you're seeing a place where the reorder affects the query results as > opposed to the query plan, that's probably a bug, can you give more > information? >