Over on the support lists we've seen a couple of examples this week of
people doing a bulk import/delete/replace cycle with a vacuum analyse
just after the delete.
Instinctively, it's where you'd vacuum and I'm guessing the analyse just
gets typed at the same time from habit (I know I've done so more than
once). Of course, it flattens your stats and your import can then take
forever.
So - would it be worth, in the case of vacuum+analyse (but not analyse
alone), where the table is completely empty then just halve the existing
stats.
That way, if you're in the middle of a delete/replace cycle your stats
will still be in the realms of reasonableness. On the other hand, if the
table is genuinely empty and you're running a nightly vacuum the stats
will tend toward 0.
Against the idea:
1. It's a special-case in the code
2. There's a work-around (unless you're running pg_autovacuum I'd guess)
2. We perhaps want a more general table description (this is a
bulk-loading table, this is a log table, this is a mostly static lookup
table)
-- Richard Huxton Archonet Ltd