Re: Optimization idea

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>, Vlad Arkhipov <arhipov(at)dc(dot)baikal(dot)ru>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Optimization idea
Date: 2010-04-23 23:09:39
Message-ID: m2u603c8f071004231609h25df8463p7e895222c216920a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Apr 23, 2010 at 6:53 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> Hmm.  We currently have a heuristic that we don't record a value as an
>> MCV unless it's more frequent than the average frequency.  When the
>> number of MCVs is substantially smaller than the number of distinct
>> values in the table this is probably a good heuristic, since it
>> prevents us from bothering with the recording of some values that are
>> probably only marginally more interesting than other values we don't
>> have space to record.  But if ndistinct is less than the stats target
>> we could in theory record every value we find in the MCVs table and
>> leave the histogram empty.
>
> Which, in fact, is exactly what we do.  Cf analyze.c lines 2414ff
> (as of CVS HEAD).  The heuristic you mention only gets applied after
> we determine that a complete MCV list won't fit.

Oh, hrmm. I guess I need to go try to understand this example again, then.

...Robert

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Eliot Gable 2010-04-24 00:39:13 Re: Replacing Cursors with Temporary Tables
Previous Message Tom Lane 2010-04-23 22:53:34 Re: Optimization idea