summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorAlvaro Herrera2006-07-10 16:20:52 +0000
committerAlvaro Herrera2006-07-10 16:20:52 +0000
commitd4cef0aa2a55fafbd9ce2783c1eb9e0157c6781e (patch)
tree321bcb690f559b2b87fe51b3fe094d9776ce690a /doc/src
parente627c9b9a6aff106adba0c486c385a53eedf6c90 (diff)
Improve vacuum code to track minimum Xids per table instead of per database.
To this end, add a couple of columns to pg_class, relminxid and relvacuumxid, based on which we calculate the pg_database columns after each vacuum. We now force all databases to be vacuumed, even template ones. A backend noticing too old a database (meaning pg_database.datminxid is in danger of falling behind Xid wraparound) will signal the postmaster, which in turn will start an autovacuum iteration to process the offending database. In principle this is only there to cope with frozen (non-connectable) databases without forcing users to set them to connectable, but it could force regular user database to go through a database-wide vacuum at any time. Maybe we should warn users about this somehow. Of course the real solution will be to use autovacuum all the time ;-) There are some additional improvements we could have in this area: for example the vacuum code could be smarter about not updating pg_database for each table when called by autovacuum, and do it only once the whole autovacuum iteration is done. I updated the system catalogs documentation, but I didn't modify the maintenance section. Also having some regression tests for this would be nice but it's not really a very straightforward thing to do. Catalog version bumped due to system catalog changes.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/catalogs.sgml44
1 files changed, 37 insertions, 7 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index cd3789f4ed2..cc42c5906ff 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.125 2006/07/03 22:45:36 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.126 2006/07/10 16:20:49 alvherre Exp $ -->
<!--
Documentation of the system catalogs, directed toward PostgreSQL developers
-->
@@ -1640,6 +1640,30 @@
</row>
<row>
+ <entry><structfield>relminxid</structfield></entry>
+ <entry><type>xid</type></entry>
+ <entry></entry>
+ <entry>
+ The minimum transaction ID present in all rows in this table. This
+ value is used to determine the database-global
+ <structname>pg_database</>.<structfield>datminxid</> value.
+ </entry>
+ </row>
+
+ <row>
+ <entry><structfield>relvacuumxid</structfield></entry>
+ <entry><type>xid</type></entry>
+ <entry></entry>
+ <entry>
+ The transaction ID that was used as cleaning point as of the last vacuum
+ operation. All rows inserted, updated or deleted in this table by
+ transactions whose IDs are below this one have been marked as known good
+ or deleted. This is used to determine the database-global
+ <structname>pg_database</>.<structfield>datvacuumxid</> value.
+ </entry>
+ </row>
+
+ <row>
<entry><structfield>relacl</structfield></entry>
<entry><type>aclitem[]</type></entry>
<entry></entry>
@@ -2022,21 +2046,27 @@
<entry><type>xid</type></entry>
<entry></entry>
<entry>
- All rows inserted or deleted by transaction IDs before this one
- have been marked as known committed or known aborted in this database.
- This is used to determine when commit-log space can be recycled.
+ The transaction ID that was used as cleaning point as of the last vacuum
+ operation. All rows inserted or deleted by transaction IDs before this one
+ have been marked as known good or deleted. This
+ is used to determine when commit-log space can be recycled.
+ If InvalidTransactionId, then the minimum is unknown and can be
+ determined by scanning <structname>pg_class</>.<structfield>relvacuumxid</>.
</entry>
</row>
<row>
- <entry><structfield>datfrozenxid</structfield></entry>
+ <entry><structfield>datminxid</structfield></entry>
<entry><type>xid</type></entry>
<entry></entry>
<entry>
+ The minimum transaction ID present in all tables in this database.
All rows inserted by transaction IDs before this one have been
relabeled with a permanent (<quote>frozen</>) transaction ID in this
- database. This is useful to check whether a database must be vacuumed
- soon to avoid transaction ID wrap-around problems.
+ database. This is useful to check whether a database must be
+ vacuumed soon to avoid transaction ID wrap-around problems.
+ If InvalidTransactionId, then the minimum is unknown and can be
+ determined by scanning <structname>pg_class</>.<structfield>relminxid</>.
</entry>
</row>