pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joseph Shraibman <jks@selectacast.net>
Cc: Greg Stark <gsstark@mit.edu>
Cc: pgsql-general@postgresql.org
Subject: Re: VACUUM Question
Date: Fri, 04 Jun 2004 16:57:05 -0400
Message-ID: <10492.1086382625@sss.pgh.pa.us> (raw)
In-Reply-To: <40C0C475.8070609@selectacast.net>
References: <40345D0D.9060103@meerkatsoft.com>
	<87smdb1k0d.fsf@stark.xeocode.com>
	<40C0C475.8070609@selectacast.net>

Joseph Shraibman <jks@selectacast.net> writes:
> Greg Stark wrote:
>> There won't be anything to VACUUM after the insert, but perhaps you still want
>> to run ANALYZE. Note that a plain ANALYZE uses a statistical sample which is
>> much faster, whereas VACUUM ANALYZE has to look at every record anyways so
>> it's slower but produces more accurate statistics. If you don't have

> That is not true.  My nightly vacuum analyze clearly is sampling:

> INFO:  "tablename": 22102 pages, 30000 rows sampled, 1712934 estimated 
> total rows

There is (only) one aspect in which VACUUM ANALYZE will produce more
accurate stats than a standalone ANALYZE: what it stores into
pg_class.reltuples is the true total tuple count produced by the VACUUM
phase, rather than the estimate produced by the ANALYZE phase.  What
goes into pg_statistic will be the same in both cases, however, and will
be based on a sample not the whole table.

BTW, a VACUUM just after a table is loaded by INSERT/COPY is not
necessarily useless.  It won't reclaim space, there being none to
reclaim, but it will mark all the rows as "known committed", thereby
saving some amount of I/O that would otherwise be incurred by later
transactions.

			regards, tom lane



view thread (33+ messages)  latest in thread

Message-ID: <10492.1086382625@sss.pgh.pa.us>
Permalink:  ../10492.1086382625@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10492.1086382625@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jks@selectacast.net, gsstark@mit.edu
  Subject: Re: VACUUM Question
  In-Reply-To: <10492.1086382625@sss.pgh.pa.us>
  References: <40345D0D.9060103@meerkatsoft.com> <87smdb1k0d.fsf@stark.xeocode.com> <40C0C475.8070609@selectacast.net> <10492.1086382625@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