X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9ED3C53C89 for ; Thu, 14 Apr 2005 14:21:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24058-02 for ; Thu, 14 Apr 2005 17:21:38 +0000 (GMT) Received: from krogh.officenet.no (unknown [128.39.244.194]) by svr1.postgresql.org (Postfix) with ESMTP id 1A52B5333E for ; Thu, 14 Apr 2005 14:21:37 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by krogh.officenet.no (Postfix) with ESMTP id ECBE211C64C; Thu, 14 Apr 2005 19:21:38 +0200 (CEST) From: Andreas Joseph Krogh Organization: OfficeNet AS To: Richard Huxton Subject: Re: row-attribute in EXPLAIN-output doesn't match count(*) Date: Thu, 14 Apr 2005 19:21:38 +0200 User-Agent: KMail/1.8 Cc: pgsql-sql@postgresql.org References: <200504141838.14705.andreak@officenet.no> <425EA496.2030501@archonet.com> In-Reply-To: <425EA496.2030501@archonet.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200504141921.38476.andreak@officenet.no> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200504/202 X-Sequence-Number: 21095 On Thursday 14 April 2005 19:12, Richard Huxton wrote: > Andreas Joseph Krogh wrote: > > Hi everybody, I have table which inly has 298 rows in it, but EXPLAIN > > ANALYZE shows that PG thinks it has as much as 160057 rows AFAICT from > > the EXPLAIN-output. > > > > > > I've just run a "VACUUM FULL VERBOSE" on the whole database, which gave > > the following output on the relevant table(onp_web_index): > > > > INFO: vacuuming "public.onp_web_index" > > INFO: "onp_web_index": found 0 removable, 160057 nonremovable row > > versions in 206940 pages > > DETAIL: 159759 dead row versions cannot be removed yet. > > A long-lived transaction can still see these row versions, so vacuum > can't delete them. Until that transaction is committed/rolled back PG > has to keep the old versions of those rows available, because it might > be able to see them. > > So - do you have an application/client that has had a single transaction > open for a long time. A very long time unless you update this table a lot. Hm, it's a web-app, and I don't hold a transaction open for a long time on= =20 purpose, but I have a line which says "idle in transaction" fromn "ps": postgres 2754 1646 0 Apr06 ? 00:00:07 postgres: nbe nbeweb 127.0.= 0.1=20 idle in transaction And by the way, I lied about the PG-version, it's 7.4.5, not 8.0.0 So, what you're suggesting is that a restart of the webapp should make vacu= um=20 able to delete those dead rows? =2D-=20 Andreas Joseph Krogh Senior Software Developer / Manager gpg public_key: http://dev.officenet.no/~andreak/public_key.asc =2D-----------------------+---------------------------------------------+ OfficeNet AS | The most difficult thing in the world is to | Hoffsveien 17 | know how to do a thing and to watch | PO. Box 425 Sk=F8yen | somebody else doing it wrong, without | 0213 Oslo | comment. | NORWAY | | Phone : +47 22 13 01 00 | | Direct: +47 22 13 10 03 | | Mobile: +47 909 56 963 | | =2D-----------------------+---------------------------------------------+