Re: Sequential Scans On Complex Query With UNION - see why this fails

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Steve Tucknott <steve(at)retsol(dot)co(dot)uk>, PostGreSQL <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Sequential Scans On Complex Query With UNION - see why this fails
Date: 2006-01-12 03:48:27
Message-ID: 08E5AFE4-8B58-4D91-82A1-501419839BE4@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Jan 12, 2006, at 12:21 , Tom Lane wrote:

> I think what's happening is that the parser implicitly parenthesizes
> like this:
>
> from ((a join b on a.x=b.y) join c on b.y=c.z)

Any idea off hand if the SQL spec has anything to say on the subject?
I haven't dug into my local version of the final draft to see.

>> I believe both join conditions and
>> restrictions are rewritten as they'd appear in the WHERE clause, so
>> you *could* put them all in the WHERE clause.
>
> Again, this is true for inner joins but very much not the case if
> any outer joins are involved.

Thanks for the clarification, Tom. While I was writing I thought that
OUTER JOIN was an exception, but I neglected to look into it or
include my thoughts.

Michael Glaesemann
grzm myrealbox com

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2006-01-12 04:42:18 Re: Sequential Scans On Complex Query With UNION - see why this fails
Previous Message Tom Lane 2006-01-12 03:21:40 Re: Sequential Scans On Complex Query With UNION - see why this fails