pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: Dave Held <dave.held@arraysg.com>
Cc: pgsql-perform <pgsql-performance@postgresql.org>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested?
Date: 27 Apr 2005 13:16:48 -0400
Message-ID: <87ekcw3zsv.fsf@stark.xeocode.com> (raw)
In-Reply-To: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184E1@asg002.asg.local>
References: <49E94D0CFCD4DB43AFBA928DDD20C8F9026184E1@asg002.asg.local>


"Dave Held" <dave.held@arraysg.com> writes:

> > Actually, it's more to characterize how large of a sample
> > we need.  For example, if we sample 0.005 of disk pages, and
> > get an estimate, and then sample another 0.005 of disk pages
> > and get an estimate which is not even close to the first
> > estimate, then we have an idea that this is a table which 
> > defies analysis based on small samples.  
> 
> I buy that.

Better yet is to use the entire sample you've gathered of .01 and then perform
analysis on that sample to see what the confidence interval is. Which is
effectively the same as what you're proposing except looking at every possible
partition.

Unfortunately the reality according to the papers that were sent earlier is
that you will always find the results disappointing. Until your sample is
nearly the entire table your estimates for n_distinct will be extremely
unreliable.

-- 
greg




view thread (53+ messages)  latest in thread

Message-ID: <87ekcw3zsv.fsf@stark.xeocode.com>
Permalink:  ../87ekcw3zsv.fsf@stark.xeocode.com/
Also on:    postgresql.org/message-id/87ekcw3zsv.fsf@stark.xeocode.com

 · 

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: gsstark@mit.edu, dave.held@arraysg.com, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested?
  In-Reply-To: <87ekcw3zsv.fsf@stark.xeocode.com>

* 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