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: 20081217091504.1FD927563FE@cvs.postgresql.org (view raw or flat)
Thread:
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:
--------------
    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

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-2014 The PostgreSQL Global Development Group