pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Cédric Villemain <cedric.villemain.debian@gmail.com>
Cc: Vlad Arkhipov <arhipov@dc.baikal.ru>
Cc: pgsql-performance@postgresql.org
Subject: Re: Optimization idea
Date: Fri, 23 Apr 2010 18:53:34 -0400
Message-ID: <18893.1272063214@sss.pgh.pa.us> (raw)
In-Reply-To: <u2n603c8f071004231506v1a46e2e1z45e81a4a56eaacc1@mail.gmail.com>
References: <4BD0161A.4010908@dc.baikal.ru>
	<4BD0430C.1050308@2ndquadrant.com>
	<4BD10805.9060004@dc.baikal.ru>
	<y2y603c8f071004230405r5fcef546l3da84c407ce2655a@mail.gmail.com>
	<q2ne94e14cd1004230609u9596f80ve2d126430be8cd86@mail.gmail.com>
	<h2z603c8f071004230636zaec7edf2y2cbc0847ba17cd51@mail.gmail.com>
	<i2ne94e14cd1004231222x5459b076w9d0d9077ad73a57a@mail.gmail.com>
	<u2n603c8f071004231506v1a46e2e1z45e81a4a56eaacc1@mail.gmail.com>

Robert Haas <robertmhaas@gmail.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.

			regards, tom lane



view thread (21+ messages)  latest in thread

Message-ID: <18893.1272063214@sss.pgh.pa.us>
Permalink:  ../18893.1272063214@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/18893.1272063214@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, cedric.villemain.debian@gmail.com, arhipov@dc.baikal.ru
  Subject: Re: Optimization idea
  In-Reply-To: <18893.1272063214@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox