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 8A76253C89 for ; Thu, 14 Apr 2005 14:10:20 -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 19428-05 for ; Thu, 14 Apr 2005 17:10:15 +0000 (GMT) Received: from smtp102.rog.mail.re2.yahoo.com (smtp102.rog.mail.re2.yahoo.com [206.190.36.80]) by svr1.postgresql.org (Postfix) with SMTP id BFFF153F87 for ; Thu, 14 Apr 2005 14:10:13 -0300 (ADT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp102.rog.mail.re2.yahoo.com with SMTP; 14 Apr 2005 17:10:13 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 443303F9C; Thu, 14 Apr 2005 13:10:12 -0400 (EDT) Date: Thu, 14 Apr 2005 13:10:12 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: row-attribute in EXPLAIN-output doesn't match count(*) Message-ID: <20050414171012.GA9027@phlogiston.dyndns.org> References: <200504141838.14705.andreak@officenet.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200504141838.14705.andreak@officenet.no> User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200504/200 X-Sequence-Number: 21093 On Thu, Apr 14, 2005 at 06:38:14PM +0200, 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. It does have 160057 rows: > 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. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You no doubt have a long-running transaction keeping the rows from being recovered. Look for "idle in transaction" as a first guess. > DETAIL: 160057 index row versions were removed. > 0 index pages have been deleted, 0 are currently reusable. > CPU 2.40s/0.92u sec elapsed 286.41 sec. > > Here it says that it removed 160057 rows, doesn't it? No; that's the index row versions. > Is this normal, shall I just overlook the "rows=160057" output from EXPLAIN, > or is something wrong? > What does the line "DETAIL: 159759 dead row versions cannot be removed yet." > mean? It means that those rows were marked invalidated after some existing transaction started. A -- Andrew Sullivan | ajs@crankycanuck.ca The plural of anecdote is not data. --Roger Brinner