Re: Improve planner cost estimations for alternative subplans - Mailing list pgsql-hackers

From Melanie Plageman
Subject Re: Improve planner cost estimations for alternative subplans
Date
Msg-id CAAKRu_Yx8o_jrg1RLGwd-0mbAEzJQhPQOUgmW0aDqVnw1mYvcA@mail.gmail.com
Whole thread Raw
In response to Improve planner cost estimations for alternative subplans  (Alexey Bashtanov <bashtanov@imap.cc>)
Responses Re: Improve planner cost estimations for alternative subplans
List pgsql-hackers


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.
 
--
Melanie Plageman

pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: DROP relation IF EXISTS Docs and Tests - Bug Fix
Next
From: Fujii Masao
Date:
Subject: Re: Review for GetWALAvailability()