Re: Parentheses in FROM clause and evaluation order.

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: dario(dot)mx(at)gmail(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Parentheses in FROM clause and evaluation order.
Date: 2005-08-15 14:02:34
Message-ID: 20050815065906.K33261@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 10 Aug 2005 dario(dot)mx(at)gmail(dot)com wrote:

> 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?

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?

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Lane Van Ingen 2005-08-15 15:00:39 Re: catch an 'update where false' ?
Previous Message Venkatesh Krishnamurthy 2005-08-15 12:37:23 Tables are not being updated Properly through Trigger