diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2007-09-10 21:40:03 +0000 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2007-09-10 21:40:03 +0000 |
commit | 6a10f0f74957190b093f1b1147b1f2767548db90 (patch) | |
tree | 44c5cb7c7bd5f2e70797c4c1e74e841f41965d6e | |
parent | f7379f5c88e0d82cf1550170dea7d545b1ea4000 (diff) | |
download | postgresql-6a10f0f74957190b093f1b1147b1f2767548db90.tar.gz postgresql-6a10f0f74957190b093f1b1147b1f2767548db90.zip |
Release the exclusive lock on the table early after truncating it in lazy
vacuum, instead of waiting till commit.
-rw-r--r-- | src/backend/commands/vacuumlazy.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c index 25e0e071a93..f9167699fa2 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.92 2007/09/10 17:58:45 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.93 2007/09/10 21:40:03 alvherre Exp $ * *------------------------------------------------------------------------- */ @@ -802,6 +802,9 @@ lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats) */ RelationTruncate(onerel, new_rel_pages); + /* Now we're OK to release the lock. */ + UnlockRelation(onerel, AccessExclusiveLock); + /* * Drop free-space info for removed blocks; these must not get entered * into the FSM! @@ -834,10 +837,6 @@ lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats) vacrelstats->rel_pages = new_rel_pages; vacrelstats->pages_removed = old_rel_pages - new_rel_pages; - /* - * We keep the exclusive lock until commit (perhaps not necessary)? - */ - ereport(elevel, (errmsg("\"%s\": truncated %u to %u pages", RelationGetRelationName(onerel), |