From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jan Poslusny <pajout(at)gingerall(dot)cz> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: query plan and parenthesis |
Date: | 2003-06-13 13:33:26 |
Message-ID: | 181.1055511206@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Jan Poslusny <pajout(at)gingerall(dot)cz> writes:
> I have following view definition given by '\d' command: SELECT t1.col1
> FROM ((table1 t1 JOIN table2 t2 ON ((t1.id = t2.id))) JOIN table3 t3 ON
> ((t2.some = t3.some)));
> Is query planner able to optimize order of joining (t1, t2), t3 or must
> join with order described by parenthesis ? This is very important for
> joining small (50 rows) and huge (5M rows) tables.
See
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=explicit-joins.html
and the same page updated for 7.4:
http://developer.postgresql.org/docs/postgres/explicit-joins.html
The discussion here seems to have gone off on a tangent: adding or
leaving out explicit parentheses *does not* affect what the planner will
do with a JOIN construct, it only makes it perfectly clear to both you
and the machine what the nesting order is. If you leave out parentheses
then the joins nest left-to-right, but this is not semantically
different from having written the same thing with parentheses,
eg, (A JOIN B ...) JOIN C ...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-06-13 13:40:17 | Re: converting from one locale to another |
Previous Message | Patrick Welche | 2003-06-13 13:00:55 | Re: [HACKERS] SAP and MySQL ... [and Benchmark] |