I think it might work out better if you ask "what
> additional conditions are needed in order to prove that this inner join
> can commute with this left join", and then work at being able to prove
> that. (It's entirely likely that the planner isn't currently gathering
> the right information for solving that problem.)
I also see this falling into a whole class of issues where the planner
could utilize the existance of FKs to plan queries better. That might
be a better first step.
-- -- Josh Berkus PostgreSQL Experts Inc.
http://www.pgexperts.com