Re: Planner hints in Postgresql

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Claudio Freire <klaussfreire(at)gmail(dot)com>, Jim Nasby <jim(at)nasby(dot)net>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, David Johnston <polobo(at)yahoo(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Planner hints in Postgresql
Date: 2014-03-18 06:04:24
Message-ID: CAMkU=1yAEB6oFFyWRObSkDKw_539QOdSYgfcLxY3RTdEg_BGRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Monday, March 17, 2014, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Claudio Freire <klaussfreire(at)gmail(dot)com <javascript:;>> writes:
> > On Mon, Mar 17, 2014 at 7:01 PM, Jim Nasby <jim(at)nasby(dot)net <javascript:;>>
> wrote:
> >> Even better would be if the planner could estimate how bad a plan will
> >> become if we made assumptions that turn out to be wrong.
>
> > That's precisely what risk estimation was about.
>
> Yeah. I would like to see the planner's cost estimates extended to
> include some sort of uncertainty estimate, whereupon risk-averse people
> could ask it to prefer low-uncertainty plans over high-uncertainty ones
> (the plans we typically choose for ORDER BY ... LIMIT queries being great
> examples of the latter). But it's a long way from wishing that to making
> it so. Right now it's not even clear (to me anyway) how we'd measure or
> model such uncertainty.
>

Most of the cases where I've run into horrible estimates, it seemed like
the same level of knowledge/reasoning that could allow us to know it was
risky, would allow us to just do a better job in the first place.

The exception I can think of is in an antijoin between two huge rels. It
is like subtracting two large measurements to get a much smaller result.
We should know the uncertainty will be large.

Cheers,

Jeff

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ronan Dunklau 2014-03-18 08:31:06 Re: Triggers on foreign tables
Previous Message Jeff Janes 2014-03-18 06:04:23 Re: Planner hints in Postgresql