From 053731ab0a3ab8dc98742a71780e52f4d39e10c4 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 10 Sep 2007 17:58:50 +0000 Subject: [PATCH] Remove the vacuum_delay_point call in count_nondeletable_pages, because we hold an exclusive lock on the table at this point, which we want to release as soon as possible. This is called in the phase of lazy vacuum where we truncate the empty pages at the end of the table. An alternative solution would be to lower the vacuum delay settings before starting the truncating phase, but this doesn't work very well in autovacuum due to the autobalancing code (which can cause other processes to change our cost delay settings). This case could be considered in the balancing code, but it is simpler this way. --- src/backend/commands/vacuumlazy.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c index b57ce14a700..06cea9a812c 100644 --- a/src/backend/commands/vacuumlazy.c +++ b/src/backend/commands/vacuumlazy.c @@ -36,7 +36,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.81 2006/11/05 22:42:08 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.81.2.1 2007/09/10 17:58:50 alvherre Exp $ * *------------------------------------------------------------------------- */ @@ -827,7 +827,11 @@ count_nondeletable_pages(Relation onerel, LVRelStats *vacrelstats) bool tupgone, hastup; - vacuum_delay_point(); + /* + * We don't insert a vacuum delay point here, because we have an + * exclusive lock on the table which we want to hold for as short + * a time as possible. + */ blkno--;