From: Jeff Boes <jboes@nexcerpt.com>
To: pgsql-admin@postgresql.org
Subject: ANALYZE not working?
Date: Mon, 06 Jan 2003 15:52:21 -0500
Message-ID: <avcq6b$187s$1@news.hub.org> (raw)
At some point after we upgraded to Postgres 7.2 from 7.1, we noticed that
VACUUM ANALYZE wasn't updating pg_class.reltuples. It only happened for
systems where we'd upgraded; a fresh installation or a new database was
not affected. So we started using
# vacuum TABLENAME; analyze TABLENAME;
where appropriate. Suddenly (like within the last week or so?), ANALYZE
isn't working properly (it is recording pg_class.reltuples far lower than
the actual row count).
This is just way too weird:
$ psql
# select count(*) from stat_fetch;
count
--------
143243
(1 row)
(Big table, two indexes.)
# analyze stat_fetch;
ANALYZE
(That should update all the stats, right?)
# select relname, reltuples from pg_class
# where relname = 'stat_fetch';
relname | reltuples
------------+-----------
stat_fetch | 3419
(1 row)
(Wha? Huh?)
# vacuum stat_fetch;
VACUUM
(That should NOT impact the stats, right?)
# select relname, reltuples from pg_class
# where relname = 'stat_fetch';
relname | reltuples
------------+-----------
stat_fetch | 179955
(1 row)
(Hmm, a bit bigger this time?!? And why so different
from the count(*)??)
# analyze stat_fetch;
ANALYZE
(Just to make sure it's not a one-time thing)
# select relname, reltuples from pg_class
# where relname = 'stat_fetch';
relname | reltuples
------------+-----------
stat_fetch | 3422
(1 row)
(I give up, I need a strong beverage of some sort ...)
--
Jeff Boes vox 616.226.9550 ext 24
Database Engineer fax 616.349.9076
Nexcerpt, Inc. http://www.nexcerpt.com
...Nexcerpt... Extend your Expertise
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-admin@postgresql.org
Cc: jboes@nexcerpt.com
Subject: Re: ANALYZE not working?
In-Reply-To: <avcq6b$187s$1@news.hub.org>
References: <avcq6b$187s$1@news.hub.org>
* 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