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

From heikki@postgresql.org (Heikki Linnakangas)
Subject pgsql: Don't reset pg_class.reltuples and relpages in VACUUM, if any
Date
Msg-id 20081217091504.1FD927563FE@cvs.postgresql.org
Whole thread Raw
List 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:
--------------
    pgsql/src/backend/commands:
        analyze.c (r1.129 -> r1.130)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/analyze.c?r1=1.129&r2=1.130)
        vacuum.c (r1.382 -> r1.383)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuum.c?r1=1.382&r2=1.383)
        vacuumlazy.c (r1.113 -> r1.114)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuumlazy.c?r1=1.113&r2=1.114)
    pgsql/src/backend/parser:
        gram.y (r2.643 -> r2.644)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/gram.y?r1=2.643&r2=2.644)
    pgsql/src/backend/postmaster:
        pgstat.c (r1.185 -> r1.186)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/postmaster/pgstat.c?r1=1.185&r2=1.186)
    pgsql/src/include:
        pgstat.h (r1.79 -> r1.80)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/pgstat.h?r1=1.79&r2=1.80)
    pgsql/src/include/commands:
        vacuum.h (r1.81 -> r1.82)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/commands/vacuum.h?r1=1.81&r2=1.82)

pgsql-committers by date:

Previous
From: momjian@postgresql.org (Bruce Momjian)
Date:
Subject: pgsql: The attached patch contains a couple of fixes in the existing
Next
From: meskes@postgresql.org (Michael Meskes)
Date:
Subject: pgsql: Applied patch by ITAGAKI Takahiro