"Glen Parker" <glenebob@nwlink.com> writes:
> First, shouldn't statistics have some clue how many rows might be in the
> table, at least right after an analyze?
Only approximately -- VACUUM or VACUUM ANALYZE will generate an
exact-as-of-the-moment reltuples entry, but just ANALYZE doesn't,
because it doesn't do a complete table scan.
We have an open bug report about ANALYZE's guesstimate sometimes being
further off than one would like. This happens because it estimates
the entire file's tuples-per-page fill factor from that of the first
few pages, and of course that could be radically wrong.
regards, tom lane