Re: Multi-pass planner

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: decibel <decibel(at)decibel(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multi-pass planner
Date: 2009-08-20 17:10:15
Message-ID: 603c8f070908201010v122e8d85nc081f06b318122c5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 20, 2009 at 12:55 PM, Kevin
Grittner<Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
>> I think one of the problems with the planner is that all decisions
>> are made on the basis of cost.  Honestly, it works amazingly well in
>> a wide variety of situations, but it can't handle things like "we
>> might as well materialize here, because it doesn't cost much and
>> there's a big upside if our estimates are off".  The estimates are
>> the world, and you live and die by them.
>
> ["thinking out loud"]
>
> If there were some reasonable way to come up with a *range* for cost
> at each step, a reasonable heuristic might be to cost the plan using
> minimum values and maximum values, and use the root mean square of the
> two for comparisons to other plans.  I don't know that we have a good
> basis to come up with ranges rather than absolute numbers, though.

Maybe. The problem is that we have mostly two cases: an estimate that
we think is pretty good based on reasonable statistics (but may be way
off if there are hidden correlations we don't know about), and a wild
guess. Also, it doesn't tend to matter very much when the estimates
are off by, say, a factor of two. The real problem is when they are
off by an order of magnitude or more.

...Robert

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2009-08-20 17:14:08 Re: WIP: generalized index constraints
Previous Message Kevin Grittner 2009-08-20 16:55:54 Re: Multi-pass planner