From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Joseph Shraibman <jks(at)selectacast(dot)net> |
Cc: | Greg Stark <gsstark(at)mit(dot)edu>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: VACUUM Question |
Date: | 2004-06-04 20:57:05 |
Message-ID: | 10492.1086382625@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Joseph Shraibman <jks(at)selectacast(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Felix Finch | 2004-06-04 21:08:28 | Dropping schemas and "illegal seek" |
Previous Message | Alvaro Herrera | 2004-06-04 20:38:15 | Re: VACUUM Question |