Scott Marlowe <scott.marlowe@gmail.com> writes:
> Without looking at the explain just yet, it seems to me that you are
> constraining the order of joins to insist that the left joins be done
> first, then the regular joins second, because of your mix of explicit
> and implicit join syntax. The query planner is constrained to run
> explicit joins first, then implicit if I remember correctly.
That isn't true as of recent releases (8.2 and up, I think). It is true
that there are semantic constraints that prevent certain combinations
of inner and outer joins from being rearranged ... but if that applies
here, it would also prevent manual rearrangement, unless the OP decides
that this query doesn't express quite what he meant.
regards, tom lane