Don't reset pg_class.reltuples and relpages in VACUUM, if any pages were
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 17 Dec 2008 09:15:03 +0000 (09:15 +0000)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 17 Dec 2008 09:15:03 +0000 (09:15 +0000)
commitdcf8409985f4db00bfb4c365792e39b70688318e
tree861a18486b7ed9b3ab02074502aa905bcaa03a8c
parent5a90bc1fbe829e04d319388b54b76c7a0fe36b58
Don't reset pg_class.reltuples and relpages in VACUUM, if any pages were
skipped. We could update relpages anyway, but it seems better to only
update it together with reltuples, because we use the reltuples/relpages
ratio in the planner. Also don't update n_live_tuples in pgstat.

ANALYZE in VACUUM ANALYZE now needs to update pg_class, if the
VACUUM-phase didn't do so. Added some boolean-passing to let analyze_rel
know if it should update pg_class or not.

I also moved the relcache invalidation (to update rd_targblock) from
vac_update_relstats to where RelationTruncate is called, because
vac_update_relstats is not called for partial vacuums anymore. It's more
obvious to send the invalidation close to the truncation that requires it.

Per report by Ned T. Crigler.
src/backend/commands/analyze.c
src/backend/commands/vacuum.c
src/backend/commands/vacuumlazy.c
src/backend/parser/gram.y
src/backend/postmaster/pgstat.c
src/include/commands/vacuum.h
src/include/pgstat.h