8.x VACUUM overestimates reltuples?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: 8.x VACUUM overestimates reltuples?
Date: 2005-02-12 06:06:34
Message-ID: 20050212060634.GA72853@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-02-12 06:16:49 Re: 8.x VACUUM overestimates reltuples?
Previous Message Tom Lane 2005-02-11 18:48:35 Re: [GENERAL] WARNING: could not remove database directory