Re: ANALYZE not working?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Boes <jboes(at)nexcerpt(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: ANALYZE not working?
Date: 2003-01-06 21:16:11
Message-ID: 3064.1041887771@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Jeff Boes <jboes(at)nexcerpt(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Ron Mayer 2003-01-06 22:09:47 Re: ANALYZE not working?
Previous Message Steve Crawford 2003-01-06 20:53:56 Re: restore/dup OIDs HELP!