Tomas Vondra <to...@vondra.me> writes: > Instead, I was thinking about the "other" joins (if there are any), that > may add or remove rows. AFAIK we want to join the dimensions at the > place with the lowest cardinality - the discussion mostly assumed the > joins would only reduce the cardinality, in which case we'd just leave > the dimensions until the very end.
> But ISTM that may not be necessarily true. Let's say there's a join that > "multiplies" each row. It'll probably be done at the end, and the > dimension joins should probably happen right before it ... not sure. I thought the idea here was to get rid of as much join order searching as we could. Insisting that we get the best possible plan anyway seems counterproductive, not to mention very messy to implement. So I'd just push all these joins to the end and be done with it. regards, tom lane