Re: row-attribute in EXPLAIN-output doesn't match count(*) - Mailing list pgsql-sql

From Andrew Sullivan
Subject Re: row-attribute in EXPLAIN-output doesn't match count(*)
Date
Msg-id 20050414171012.GA9027@phlogiston.dyndns.org
Whole thread Raw
In response to row-attribute in EXPLAIN-output doesn't match count(*)  (Andreas Joseph Krogh <andreak@officenet.no>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: PFC
Date:
Subject: Re: Very low performance on table with only 298 rows
Next
From: Richard Huxton
Date:
Subject: Re: row-attribute in EXPLAIN-output doesn't match count(*)