Jeff Janes <jeff.janes@gmail.com> writes:
> The slowness was introduced with this:
> Use parameterized paths to generate inner indexscans more flexibly.
Try increasing from_collapse_limit to 11 or more.
I'm not exactly sure why the param-path patch might have changed this
behavior, but in any case the collapse limits ought to be the first
thing you think of when you see a crappy plan for a many-relation query.
The curious join nesting in this query makes me wonder if perhaps it was
hand-optimized to fit the behavior of some old version of the planner ...
regards, tom lane