Alvaro Herrera wrote:
> Tom Lane wrote:
> > Alvaro Herrera <[EMAIL PROTECTED]> writes:
> > > What I'm requesting here is that the sleep in count_nondeletable_pages()
> > > be removed and that change backpatched to 8.2 and 8.1.
> >
> > Are you sure that that is, and always will be, the only sleep in that
> > part of the code path?
>
> It is currently, as far as I can see, the only sleep. I think we could
> backpatch the removal of that call, and consider changing the
> cost_delay parameters when we acquire the exclusive lock in HEAD.
I noticed that autovacuum can reset VacuumCostDelay to a non-zero value
when the cost balancing code runs. Of course, we can reset the target
value so that resetting it does not cause a problem.
I propose applying this patch from 8.1 onwards. HEAD would get an
additional treatment to avoid the balancing problem.
Note that I am releasing the exclusive lock on the table after the
truncate is done.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Index: src/backend/commands/vacuumlazy.c
===================================================================
RCS file: /home/alvherre/cvs/pgsql/src/backend/commands/vacuumlazy.c,v
retrieving revision 1.61.2.2
diff -c -p -r1.61.2.2 vacuumlazy.c
*** src/backend/commands/vacuumlazy.c 4 Mar 2006 19:09:23 -0000 1.61.2.2
--- src/backend/commands/vacuumlazy.c 26 Jul 2007 06:01:59 -0000
*************** lazy_truncate_heap(Relation onerel, LVRe
*** 821,828 ****
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",
--- 821,829 ----
vacrelstats->pages_removed = old_rel_pages - new_rel_pages;
/*
! * Release our exclusive lock before going away
*/
+ UnlockRelation(onerel, AccessExclusiveLock);
ereport(elevel,
(errmsg("\"%s\": truncated %u to %u pages",
*************** count_nondeletable_pages(Relation onerel
*** 854,861 ****
bool tupgone,
hastup;
- vacuum_delay_point();
-
blkno--;
buf = ReadBuffer(onerel, blkno);
--- 855,860 ----
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly