Re: Multi-pass planner

From: Claudio Freire <klaussfreire(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Greg Stark <stark(at)mit(dot)edu>, decibel <decibel(at)decibel(dot)org>, Josh Berkus <josh(at)agliodbs(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multi-pass planner
Date: 2013-04-19 21:24:12
Message-ID: CAGTBQpYyaHPeQzZnkseRxcn5Xm4zRuvB7bes8xJBgsQq-EPYpg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 19, 2013 at 6:19 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
> On Wed, Apr 3, 2013 at 6:40 PM, Greg Stark <stark(at)mit(dot)edu> wrote:
>>
>>
>> On Fri, Aug 21, 2009 at 6:54 PM, decibel <decibel(at)decibel(dot)org> wrote:
>>>
>>> Would it? Risk seems like it would just be something along the lines of
>>> the high-end of our estimate. I don't think confidence should be that hard
>>> either. IE: hard-coded guesses have a low confidence. Something pulled right
>>> out of most_common_vals has a high confidence.
>
>
> I wouldn't be so sure of that. I've run into cases where all of the
> frequencies pulled out of most_common_vals are off by orders of magnitude.
> The problem is that if ANALYZE only samples 1/1000th of the table, and it
> sees a value twice, it assumes the value is present 2000 times in the table,
> even when it was only in the table twice. Now, for any given value that
> occurs twice in the table, it is very unlikely for both of those to end up
> in the sample. But when you have millions of distinct values which each
> occur twice (or some low number of time), it is a near certainty that
> several of them are going to end with both instances in the sample. Those
> few ones that get "lucky" are of course going to end up in the
> most_common_vals list.

Especially if there's some locality of occurrence, since analyze
samples pages, not rows.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2013-04-19 21:49:20 Re: Multi-pass planner
Previous Message Jeff Janes 2013-04-19 21:19:46 Re: Multi-pass planner