8.x VACUUM overestimates reltuples?

Started by Michael Fuhralmost 21 years ago3 messages
#1Michael Fuhr
mike@fuhr.org

Is VACUUM in 8.x supposed to be overestimating reltuples by 50% of
the number of dead tuples?

CREATE TABLE foo (x integer);
INSERT INTO foo SELECT * FROM generate_series(1, 1000);
UPDATE foo SET x = x;
UPDATE foo SET x = x;
UPDATE foo SET x = x;
VACUUM foo;
SELECT relpages, reltuples FROM pg_class WHERE relname = 'foo';
relpages | reltuples
----------+-----------
22 | 2500

Another VACUUM at this point brings reltuples back to the actual
number of rows in the table:

VACUUM foo;
SELECT relpages, reltuples FROM pg_class WHERE relname = 'foo';
relpages | reltuples
----------+-----------
22 | 1000

Is this intentional?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Fuhr (#1)
Re: 8.x VACUUM overestimates reltuples?

Michael Fuhr <mike@fuhr.org> writes:

Is VACUUM in 8.x supposed to be overestimating reltuples by 50% of
the number of dead tuples?

See this thread:
http://archives.postgresql.org/pgsql-hackers/2004-11/msg01043.php

regards, tom lane

#3Michael Fuhr
mike@fuhr.org
In reply to: Tom Lane (#2)
Re: 8.x VACUUM overestimates reltuples?

On Sat, Feb 12, 2005 at 01:16:49AM -0500, Tom Lane wrote:

Michael Fuhr <mike@fuhr.org> writes:

Is VACUUM in 8.x supposed to be overestimating reltuples by 50% of
the number of dead tuples?

See this thread:
http://archives.postgresql.org/pgsql-hackers/2004-11/msg01043.php

Thanks -- not sure how I missed that thread in my searches. I
wondered if the reason might be what your message talks about but
I wanted to check.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/