Re: Quick idea for reducing VACUUM contention - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Quick idea for reducing VACUUM contention
Date
Msg-id 20070730204758.GM7628@alvh.no-ip.org
Whole thread Raw
In response to Re: Quick idea for reducing VACUUM contention  (Jim Nasby <decibel@decibel.org>)
Responses Re: Quick idea for reducing VACUUM contention  (Decibel! <decibel@decibel.org>)
List pgsql-hackers
Jim Nasby wrote:
> On Jul 27, 2007, at 1:49 AM, Alvaro Herrera wrote:
>> ITAGAKI Takahiro wrote:
>>> "Simon Riggs" <simon@2ndquadrant.com> wrote:
>>>
>>>> Read the heap blocks in sequence, but make a conditional lock for
>>>> cleanup on each block. If we don't get it, sleep, then try again when we
>>>> wake up. If we fail the second time, just skip the block completely.
>>
>> It would be cool if we could do something like sweep a range of pages,
>> initiate IO for those that are not in shared buffers, and while that is
>> running, lock and clean up the ones that are in shared buffers, skipping
>> those that are not lockable right away; when that's done, go back to
>> those buffers that were gotten from I/O and clean those up.  And retry
>> the locking for those that couldn't be locked the first time around,
>> also conditionally.  And when that's all done, a third pass could get
>> those blocks that weren't cleaned up in none of the previous passes (and
>> this time the lock would not be conditional).
>
> Would that be substantially easier than just creating a bgreader?

I'm not sure about easier, but I'm not sure that the bgreader can do the
same job.  ISTM that the bgreader would be mostly in charge of reading
in advance of backends, whereas what I'm proposing is mostly about
finding the best spot for locking.  It might turn out to be more trouble
than it's worth though, for sure.  And in any case I'm not in a hurry to
implement it.

In any case I'm not so sure about skipping vacuuming a block if it's not
lockable.

-- 
Alvaro Herrera                 http://www.amazon.com/gp/registry/CTMLCN8V17R4
"Crear es tan difícil como ser libre" (Elsa Triolet)


pgsql-hackers by date:

Previous
From: Devrim GÜNDÜZ
Date:
Subject: Re: Machine available for community use
Next
From: "Simon Riggs"
Date:
Subject: Reducing Transaction Start/End Contention