From: Kevin Grittner <kgrittn@ymail.com>
To: jimbob@seagate.com <jimbob@seagate.com>
To: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #7853: Incorrect statistics in table with many dead rows.
Date: Tue, 5 Feb 2013 14:00:46 -0800 (PST)
Message-ID: <1360101646.24672.YahooMailNeo@web162901.mail.bf1.yahoo.com> (raw)
In-Reply-To: <E1U2nS6-0003ky-CY@wrigleys.postgresql.org>
References: <E1U2nS6-0003ky-CY@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
"jimbob@seagate.com" <jimbob@seagate.com> wrote:
> INFO: analyzing "public.stream_file"
> INFO: "stream_file": scanned 30000 of 2123642 pages, containing
> 184517 live rows and 2115512 dead rows; 30000 rows in sample,
> 158702435 estimated total rows
184517 live rows in 30000 randomly sampled pages out of 2123642
total pages, means that the statistics predict that a select
count(*) will find about 13 million live rows to count.
> After "analyze verbose", the table shows 158 million rows. A
> select count(1) yields 13.8 million rows.
OK, the estimate was 13 million and there were actually 13.8
million, but it is a random sample used to generate estimates.
That seems worse than average, but close enough to be useful.
The 158.7 million total rows includes dead rows, which must be
visited to determine visibility, but will not be counted because
they are not visible to the counting transaction. Having over 90%
of your table filled with dead rows is a bad situation to be in,
from a performance standpoint. You should use aggressive
maintenance (like VACUUM FULL or CLUSTER) to fix the existing
extreme bloat, and then review your autovacuum settings and overall
vacuum regimen to prevent future bloat.
This does not look like a bug from the information provided so far.
-Kevin
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: kgrittn@ymail.com, jimbob@seagate.com
Subject: Re: BUG #7853: Incorrect statistics in table with many dead rows.
In-Reply-To: <1360101646.24672.YahooMailNeo@web162901.mail.bf1.yahoo.com>
References: <E1U2nS6-0003ky-CY@wrigleys.postgresql.org> <1360101646.24672.YahooMailNeo@web162901.mail.bf1.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox