Don't reset pg_class.reltuples and relpages in VACUUM, if any pages were
authorHeikki Linnakangas <[email protected]>
Wed, 17 Dec 2008 09:15:03 +0000 (09:15 +0000)
committerHeikki Linnakangas <[email protected]>
Wed, 17 Dec 2008 09:15:03 +0000 (09:15 +0000)
commitbca52b1c91fe6eed2b7e46fdae3259afacf373a4
treebad7ea7c9229422afe5a36b4b1fe0366c5ef7ef7
parentfd3b2f09e8060a1cbb67604151a3e2fc02e00eb0
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