pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Boes <jboes@nexcerpt.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: ANALYZE not working?
Date: Mon, 06 Jan 2003 16:16:11 -0500
Message-ID: <3064.1041887771@sss.pgh.pa.us> (raw)
In-Reply-To: <avcq6b$187s$1@news.hub.org>
References: <avcq6b$187s$1@news.hub.org>

Jeff Boes <jboes@nexcerpt.com> writes:
> 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?)

Have you done VACUUM FULL on this table in living memory?

The current implementation of ANALYZE can get fooled if the table has
very nonuniform tuple density (eg, lots of empty or near-empty pages
near the beginning, and filled pages near the end).

I'd try "vacuum full verbose stat_fetch" and note whether it shrinks the
table a lot.  (If it does, that suggests that you need more frequent
regular vacuums, and/or larger FSM settings in postgresql.conf.)

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <3064.1041887771@sss.pgh.pa.us>
Permalink:  ../3064.1041887771@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3064.1041887771@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, jboes@nexcerpt.com
  Subject: Re: ANALYZE not working?
  In-Reply-To: <3064.1041887771@sss.pgh.pa.us>
  References: <avcq6b$187s$1@news.hub.org> <3064.1041887771@sss.pgh.pa.us>

* 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