Skip site navigation (1) Skip section navigation (2)

pgsql: Don't reset pg_class.reltuples and relpages in VACUUM, if any

From: heikki(at)postgresql(dot)org (Heikki Linnakangas)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Don't reset pg_class.reltuples and relpages in VACUUM, if any
Date: 2008-12-17 09:15:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committers
Log Message:
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.

Modified Files:
        analyze.c (r1.129 -> r1.130)
        vacuum.c (r1.382 -> r1.383)
        vacuumlazy.c (r1.113 -> r1.114)
        gram.y (r2.643 -> r2.644)
        pgstat.c (r1.185 -> r1.186)
        pgstat.h (r1.79 -> r1.80)
        vacuum.h (r1.81 -> r1.82)

pgsql-committers by date

Next:From: Michael MeskesDate: 2008-12-17 16:52:07
Subject: pgsql: Applied patch by ITAGAKI Takahiro
Previous:From: Bruce MomjianDate: 2008-12-17 01:39:04
Subject: pgsql: The attached patch contains a couple of fixes in the existing

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group