Forum OpenACS Development: Re: PREPARE considered beneficial

Collapse
Posted by Mark Aufflick on
You will be able to achieve that nicely when plpgsql functions returning rowsets will be able to be used as sub-selects.

I think that has made it into the 7.5 plan?

Collapse
Posted by Jeff Davis on
In general you will get a better plan if you give the optimizer the option of flattening subselects so I doubt in general using a plpgsql proc (or smarter subselect plan caching) is the right answer.

One of the most common way we end up with really bad plans is that we have deeply nested views which exceed the count of joins that the optimizer will consider for flattening. It used to be GEQO_THRESHOLD/2 joins (6 I think) in <7.4 but they added a seperate parameter for it in 7.4 -- from_collapse_limit = 8 (docs).