1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Utilize the visibility map in autovacuum, too. There was an oversight in

the visibility map patch that because autovacuum always sets
VacuumStmt->freeze_min_age, visibility map was never used for autovacuum,
only for manually launched vacuums. This patch introduces a new scan_all
field to VacuumStmt, indicating explicitly whether the visibility map
should be used, or the whole relation should be scanned, to advance
relfrozenxid. Anti-wraparound vacuums still need to scan all pages.
This commit is contained in:
Heikki Linnakangas
2008-12-04 11:42:24 +00:00
parent 69b3383cfb
commit 7537f52a00
6 changed files with 14 additions and 14 deletions

View File

@ -29,7 +29,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.112 2008/12/03 13:05:22 heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.113 2008/12/04 11:42:23 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@ -143,7 +143,6 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
BlockNumber possibly_freeable;
PGRUsage ru0;
TimestampTz starttime = 0;
bool scan_all;
pg_rusage_init(&ru0);
@ -169,15 +168,9 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
/* Open all indexes of the relation */
vac_open_indexes(onerel, RowExclusiveLock, &nindexes, &Irel);
vacrelstats->hasindex = (nindexes > 0);
/* Should we use the visibility map or scan all pages? */
if (vacstmt->freeze_min_age != -1)
scan_all = true;
else
scan_all = false;
/* Do the vacuuming */
lazy_scan_heap(onerel, vacrelstats, Irel, nindexes, scan_all);
lazy_scan_heap(onerel, vacrelstats, Irel, nindexes, vacstmt->scan_all);
/* Done with indexes */
vac_close_indexes(nindexes, Irel, NoLock);