> My question is whether it should be added as an optional facility of a > parameterised sub plan, rather than an always-needed full-strength node. > That way the choice of whether to use it can happen at execution time once > we notice that we've been called too many times. > > Actually I am not sure about what does the "parameterized sub plan" mean (I treat is a SubPlan Node), so please correct me if I misunderstand you:) Because the inner plan in nest loop not a SubPlan node actually. so if bind the facility to SubPlan node, we may loss the chances for nest loop. And when we consider the usage for nest loop, we can consider the below example, where this feature will be more powerful.
select j1o.i, j2_v.sum_5 from j1 j1o inner join lateral (select im100, sum(im5) as sum_5 from j2 where j1o.im100 = im100 and j1o.i = 1 group by im100) j2_v on true where j1o.i = 1; -- Best Regards Andy Fan