From 57851882de65937f5314c3fc515fabd522c0d2b3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 11 Dec 2008 18:16:18 +0000 Subject: [PATCH] To reduce confusion over whether VACUUM FULL is needed for anti-wraparound vacuuming (it's not), say "database-wide VACUUM" instead of "full-database VACUUM" in the relevant hint messages. Also, document the permissions needed to do this. Per today's discussion. --- doc/src/sgml/maintenance.sgml | 6 +++++- doc/src/sgml/ref/vacuum.sgml | 14 ++++++++++++-- src/backend/access/transam/varsup.c | 4 ++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index 4ae6bd5553..03ce2e94ab 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -472,9 +472,13 @@ SELECT datname, age(datfrozenxid) FROM pg_database; WARNING: database "mydb" must be vacuumed within 177009986 transactions -HINT: To avoid a database shutdown, execute a full-database VACUUM in "mydb". +HINT: To avoid a database shutdown, execute a database-wide VACUUM in "mydb". + (A manual VACUUM should fix the problem, as suggested by the + hint; but note that the VACUUM must be performed by a + superuser, else it will fail to process system catalogs and thus not + be able to advance the database's datfrozenxid.) If these warnings are ignored, the system will shut down and refuse to execute any new transactions once there are fewer than 1 million transactions left diff --git a/doc/src/sgml/ref/vacuum.sgml b/doc/src/sgml/ref/vacuum.sgml index 6364ff030c..bee0667982 100644 --- a/doc/src/sgml/ref/vacuum.sgml +++ b/doc/src/sgml/ref/vacuum.sgml @@ -40,8 +40,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ With no parameter, VACUUM processes every table in the - current database. With a parameter, VACUUM processes - only that table. + current database that the current user has permission to vacuum. + With a parameter, VACUUM processes only that table. @@ -146,6 +146,16 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ Notes + + To vacuum a table, one must ordinarily be the table's owner or a + superuser. However, database owners are allowed to + vacuum all tables in their databases, except shared catalogs. + (The restriction for shared catalogs means that a true database-wide + VACUUM can only be performed by a superuser.) + VACUUM will skip over any tables that the calling user + does not have permission to vacuum. + + VACUUM cannot be executed inside a transaction block. diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index 3faf12272d..8cadc3c0d4 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -93,7 +93,7 @@ GetNewTransactionId(bool isSubXact) (errmsg("database \"%s\" must be vacuumed within %u transactions", NameStr(ShmemVariableCache->limit_datname), ShmemVariableCache->xidWrapLimit - xid), - errhint("To avoid a database shutdown, execute a full-database VACUUM in \"%s\".", + errhint("To avoid a database shutdown, execute a database-wide VACUUM in \"%s\".", NameStr(ShmemVariableCache->limit_datname)))); } @@ -299,7 +299,7 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid, (errmsg("database \"%s\" must be vacuumed within %u transactions", NameStr(*oldest_datname), xidWrapLimit - curXid), - errhint("To avoid a database shutdown, execute a full-database VACUUM in \"%s\".", + errhint("To avoid a database shutdown, execute a database-wide VACUUM in \"%s\".", NameStr(*oldest_datname)))); } -- 2.39.5