From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Visibility map and freezing |
Date: | 2008-12-17 09:40:33 |
Message-ID: | 4948C911.7080901@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
The way VACUUM works with the visibility map is that if any pages are
skipped, relfrozenxid can't be updated. That means that plain VACUUM
won't advance relfrozenxid, and doesn't protect from XID wraparound.
We discussed this in the context of autovacuum before, and we have that
covered now. Autovacuum will launch a full-scanning vacuum that advances
relfrozenxid, when autovacuum_freeze_max_age is reached, and partial
vacuums otherwise.
Autovacuum will launch anti-wraparound vacuum even if it's otherwise
disabled. Which is good, but it'll be an unpleasant surprise for someone
who performs a simple manual database-wide "VACUUM", for example, every
night from a cron job. You could run VACUUM FREEZE, say monthly, to
force a full-scanning vacuum, but that's unnecessarily aggressive, and
you need to know about the issue to set that up in the first place.
I think we need a threshold similar to autovacuum_freeze_max_age for
manual vacuums as well: vacuum_freeze_max_age. If you run VACUUM, and
relfrozenxid is older than vacuum_freeze_max_age, the visibility map is
ignored and all pages are scanned.
This ensures that you don't run into forced anti-wraparound autovacuums
if you do your VACUUMs manually.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2008-12-17 09:59:31 | Re: visibility maps |
Previous Message | Tatsuo Ishii | 2008-12-17 09:22:01 | Re: WAL documentation changes |