pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Litao Wu <litaowu@yahoo.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: reltuples after vacuum and analyze
Date: Mon, 24 Jan 2005 19:26:26 -0500
Message-ID: <27553.1106612786@sss.pgh.pa.us> (raw)
In-Reply-To: <20050124230242.18329.qmail@web30304.mail.mud.yahoo.com>
References: <20050124230242.18329.qmail@web30304.mail.mud.yahoo.com>

Litao Wu <litaowu@yahoo.com> writes:
> I noticed that reltuples are way off if
> I vacuum the table and analyze the table.
> And the data (296901) after vacuum seems 
> accurate while
> the reltuples (1.90744e+06)
> after anlayze is too wrong.

VACUUM derives an exact count because it scans the whole table.  ANALYZE
samples just a subset of the table and extrapolates.  It would appear
that you've got radically different tuple densities in different parts
of the table, and that's confusing ANALYZE.

> My PG version is 7.3.2 (I know it is old).

8.0's ANALYZE uses a new sampling method that we think is less prone
to this error, though of course any sampling method will fail some of
the time.

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <27553.1106612786@sss.pgh.pa.us>
Permalink:  ../27553.1106612786@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27553.1106612786@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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, litaowu@yahoo.com
  Subject: Re: reltuples after vacuum and analyze
  In-Reply-To: <27553.1106612786@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