pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-perform <pgsql-performance@postgresql.org>
To: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested?
Date: Mon, 25 Apr 2005 12:13:18 -0700
Message-ID: <200504251213.18565.josh@agliodbs.com> (raw)
In-Reply-To: <1114454941.21529.245.camel@localhost.localdomain>
References: <200504191209.05181.josh@agliodbs.com>
	<19276.1114442580@sss.pgh.pa.us>
	<1114454941.21529.245.camel@localhost.localdomain>

Simon, Tom:

While it's not possible to get accurate estimates from a fixed size sample, I 
think it would be possible from a small but scalable sample: say, 0.1% of all 
data pages on large tables, up to the limit of maintenance_work_mem.  

Setting up these samples as a % of data pages, rather than a pure random sort, 
makes this more feasable; for example, a 70GB table would only need to sample 
about 9000 data pages (or 70MB).  Of course, larger samples would lead to 
better accuracy, and this could be set through a revised GUC (i.e., 
maximum_sample_size, minimum_sample_size).   

I just need a little help doing the math ... please?

-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco



view thread (53+ messages)  latest in thread

Message-ID: <200504251213.18565.josh@agliodbs.com>
Permalink:  ../200504251213.18565.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200504251213.18565.josh@agliodbs.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: josh@agliodbs.com, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested?
  In-Reply-To: <200504251213.18565.josh@agliodbs.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