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