X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 46A334758E6 for ; Tue, 8 Apr 2003 14:07:48 -0400 (EDT) Received: from yapok.nexcerpt.com (mail.nexcerpt.com [64.147.202.2]) by postgresql.org (Postfix) with ESMTP id 3D10C474E42 for ; Tue, 8 Apr 2003 14:07:46 -0400 (EDT) Received: from takin.private.nexcerpt.com (zorro.nexcerpt.com [64.147.202.1]) by yapok.nexcerpt.com (8.11.6/8.11.6) with ESMTP id h38I7ik08515; Tue, 8 Apr 2003 14:07:44 -0400 Subject: Re: pg_class.reltuples not reset by VACUUM? From: Jeff Boes To: Tom Lane Cc: pgsql-admin@postgresql.org In-Reply-To: <15397.1049824333@sss.pgh.pa.us> References: <15397.1049824333@sss.pgh.pa.us> Content-Type: text/plain Organization: Nexcerpt, Inc. Message-Id: <1049825429.4871.36.camel@takin.private.nexcerpt.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 08 Apr 2003 14:10:29 -0400 Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-39.4 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, QUOTE_TWICE_1,REFERENCES,REPLY_WITH_QUOTES, USER_AGENT_XIMIAN autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/103 X-Sequence-Number: 8258 On Tue, 2003-04-08 at 13:52, Tom Lane wrote: > Jeff Boes writes: > > I thought that VACUUM ANALYZE would always restore some sense of reality > > to the internal statistics for a table. However ... > > Could we see the output of VACUUM VERBOSE for that table? No, not since I've dropped and recreated it... > > I suspect you have lots of dead-but-not-yet-reclaimable tuples in the > table, presumably because there is some very old transaction lurking > in the background. > Well, here's the present state of the table, 24 hours later: explain select count(*) from job_queue; NOTICE: QUERY PLAN: Aggregate (cost=11248.76..11248.76 rows=1 width=0) -> Seq Scan on job_queue (cost=0.00..10357.81 rows=356381 width=0) EXPLAIN # select count(*) from job_queue; count ------- 2369 (1 row) # vacuum analyze verbose job_queue; NOTICE: --Relation job_queue-- NOTICE: Pages 6831: Changed 2, Empty 0; Tup 358441: Vac 0, Keep 356048, UnUsed 5. Total CPU 0.00s/0.15u sec elapsed 0.16 sec. NOTICE: --Relation pg_toast_292377168-- NOTICE: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. NOTICE: Analyzing job_queue VACUUM # explain select count(*) from job_queue; NOTICE: QUERY PLAN: Aggregate (cost=11311.51..11311.51 rows=1 width=0) -> Seq Scan on job_queue (cost=0.00..10415.41 rows=358441 width=0) EXPLAIN # analyze verbose job_queue; NOTICE: Analyzing job_queue ANALYZE xifos:~ # explain select count(*) from job_queue; NOTICE: QUERY PLAN: Aggregate (cost=6861.41..6861.41 rows=1 width=0) -> Seq Scan on job_queue (cost=0.00..6855.33 rows=2433 width=0) EXPLAIN -- Jeff Boes vox 269.226.9550 ext 24 Database Engineer fax 269.349.9076 Nexcerpt, Inc. http://www.nexcerpt.com ...Nexcerpt... Extend your Expertise