pg_class.reltuples not reset by VACUUM? - Mailing list pgsql-admin

From Jeff Boes
Subject pg_class.reltuples not reset by VACUUM?
Date
Msg-id b6v1p3$cp4$1@news.hub.org
Whole thread Raw
Responses Re: pg_class.reltuples not reset by VACUUM?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problems with C Language Functions after upgrade to 7.3.2
Next
From: Jeff Boes
Date:
Subject: VACUUM slow on small table