pg_class.reltuples not reset by VACUUM?

From: Jeff Boes <jboes(at)nexcerpt(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: pg_class.reltuples not reset by VACUUM?
Date: 2003-04-08 17:46:49
Message-ID: b6v1p3$cp4$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I thought that VACUUM ANALYZE would always restore some sense of reality
to the internal statistics for a table. However ...

# select count(*) from job_queue;

count
-------
834
(1 row)

# select reltuples from pg_class where relname = 'job_queue';

reltuples
-----------
206277
(1 row)

# vacuum analyze job_queue;

# select reltuples from pg_class where relname = 'job_queue';

reltuples
-----------
2062xx (slightly larger number)
(1 row)

This is of concern to me mostly because:

# explain select * from job_queue;

NOTICE: QUERY PLAN:

Seq Scan on job_queue (cost=0.00..5989.77 rows=206277 width=95)

Obviously, the optimizer thinks that the table has 200k rows in it!

--
Jeff Boes vox 616.226.9550 ext 24
Database Engineer fax 616.349.9076
Nexcerpt, Inc. http://www.nexcerpt.com
...Nexcerpt... Extend your Expertise

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2003-04-08 17:52:13 Re: pg_class.reltuples not reset by VACUUM?
Previous Message Jeff Boes 2003-04-08 17:41:16 VACUUM slow on small table