pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Gould <daveg@sonic.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>
Cc: pgsql-hackers@lists.postgresql.org, Alina Alexeeva <alexeeva@adobe.com>
Cc: Ullas Lakkur Raghavendra <lakkurra@adobe.com>
Subject: Re: [patch] BUG #15005: ANALYZE can make pg_class.reltuples inaccurate.
Date: Fri, 2 Mar 2018 18:57:52 -0800
Message-ID: <20180302185752.46b82671@engels> (raw)
In-Reply-To: <32701.1520029049@sss.pgh.pa.us>
References: <20180117164916.3fdcf2e9@engels>
	<fa8122c2-ea7a-ff38-49ac-e6616aec38ea@postgrespro.ru>
	<20180228192337.67cc3f99@engels>
	<4988c54a-1709-a978-9a43-65f8a1e09e94@postgrespro.ru>
	<18522.1519916974@sss.pgh.pa.us>
	<1386effe-0e6d-fd5a-6f0d-f294e4ef2dda@postgrespro.ru>
	<3240.1519948160@sss.pgh.pa.us>
	<101dd073-1cb7-b471-7eeb-aa9ee928a1c9@postgrespro.ru>
	<20180302140037.00af305d@engels>
	<32701.1520029049@sss.pgh.pa.us>

On Fri, 02 Mar 2018 17:17:29 -0500
Tom Lane <tgl@sss.pgh.pa.us> wrote:


> But by the same token, analyze only looked at 0.0006 of the pages.  It's
> nice that for you, that's enough to get a robust estimate of the density
> everywhere; but I have a nasty feeling that that won't hold good for
> everybody.

My grasp of statistics is somewhat weak, so please inform me if I've got
this wrong, but every time I've looked into it I've found that one can get
pretty good accuracy and confidence with fairly small samples. Typically 1000
samples will serve no matter the population size if the desired margin of
error is 5%. Even with 99% confidence and a 1% margin of error it takes less
than 20,000 samples. See the table at:

http://www.research-advisors.com/tools/SampleSize.htm

Since we have by default 30000 sample pages and since ANALYZE takes some
trouble to get a random sample I think we really can rely on the results of
extrapolating reltuples from analyze.

-dg

-- 
David Gould                                   daveg@sonic.net
If simplicity worked, the world would be overrun with insects.




view thread (33+ messages)  latest in thread

Message-ID: <20180302185752.46b82671@engels>
Permalink:  ../20180302185752.46b82671@engels/
Also on:    postgresql.org/message-id/20180302185752.46b82671@engels

 · 

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-hackers@postgresql.org
  Cc: daveg@sonic.net, tgl@sss.pgh.pa.us, a.kuzmenkov@postgrespro.ru, alexeeva@adobe.com, lakkurra@adobe.com
  Subject: Re: [patch] BUG #15005: ANALYZE can make pg_class.reltuples inaccurate.
  In-Reply-To: <20180302185752.46b82671@engels>

* 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