Robert Haas <robertmhaas@gmail.com> writes:
> Not sure what you mean. There's already a special-case code path for
> cross joins; but I think it's probably considering a lot of silly
> paths. Is there a case where it makes sense to do cross joins at some
> stage of the process other than last?
They *are* done last, as a rule, because of the heuristic that prefers to
join where there's a join clause. (However I've gotten negative comments
about that --- some people think that when joining small detail tables
to a big fact table, it'd be better to cross-join the detail tables and
then do one multi-clause join to the big table. I'm unconvinced myself
but there does seem to be more than one school of thought about it.)
regards, tom lane