On Fri, Jun 5, 2020 at 9:08 AM Alexey Bashtanov <bashtanov@imap.cc> wrote:
In [1] we found a situation where it leads to a suboptimal plan, as it bloats the overall cost into large figures, a decision related to an outer part of the plan look negligible to the planner, and as a result it doesn't elaborate on choosing the optimal one.
Did this geometric average method result in choosing the desired plan for
this case?
The patch is to fix it. Our linear model for costs cannot quite accommodate the piecewise linear matter of alternative subplans, so it is based on ugly heuristics and still cannot be very precise, but I think it's better than the current one.
Thoughts?
Is there another place in planner where two alternatives are averaged together and that cost is used?
To me, it feels a little bit weird that we are averaging together the startup cost of a plan which will always have a 0 startup cost and a plan that will always have a non-zero startup cost and the per tuple cost of a plan that will always have a negligible per tuple cost and one that might have a very large per tuple cost.
I guess it feels different because instead of comparing alternatives you are blending them.
I don't have any academic basis for saying that the alternatives costs shouldn't be averaged together for use in the rest of the plan, so I could definitely be wrong.