On Fri, Mar 25, 2011 at 3:18 PM, Robert Haas <robertmh...@gmail.com> wrote:
> On Fri, Mar 25, 2011 at 3:32 PM, Heikki Linnakangas
> <heikki.linnakan...@enterprisedb.com> wrote:
>> On 25.03.2011 16:52, Merlin Moncure wrote:
>>>
>>> Without this bit, the only way to set hint bits going during bufmgr
>>> eviction is to do a visibility check on every tuple, which would
>>> probably be prohibitively expensive.
>>
>> I don't think the naive approach of scanning all tuples would be too bad,
>> actually. The hint bits only need to be set once, and it'd be bgwriter
>> shouldering the overhead.
>
> I was thinking the same thing.  The only thing I'm worried about is
> whether it'd make the bgwriter less responsive; we already have some
> issues in that department.

I'd like to experiment on this and see what comes out.  If the
bgwriter was to be granted the ability to inspect buffers and set
hints, it needs to be able to peek in and inspect the buffer itself
which it currently doesn't do FWICT.  I was thinking about setting a
flag in the buffer (BM_HEAP) that gets set by the loader which flags
the buffer for later inspection.  Is there a simpler way to do this?

It may turn out to be a dud, but I'd still like to play with the all
visible bit and see how that interacts with data loading, both with
and without special bgwriter logic (i'm going to kludge in a crude
mechanism to try to prefer non all visible pages).  The reason why I
like it is the optimization is narrow and the risk of downside is low,
although it's up a notch on the complexity level.  If you do end up
retooling the bgwriter to set hint bits broadly, there are some tricks
you can do to reduce the number of useless clog checks you do (that
is, you fault through to an in progress transaction).  They involve
changing the way the scan works, maybe even organizing buffers into
multiple priority pools, so it's complicated and has to be done very
carefully.

I think you guys are correct: the logic belongs in the bgwriter.
Generally speaking, it looks like the best route to minimizing hint
bit pain is to if at all possible write them out set so they don't
have to be rewritten later (Stephen's approach to leverage in
transaction table creation is another way of attempting to do that).

merlin

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to