Re: Turning off HOT/Cleanup sometimes - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Turning off HOT/Cleanup sometimes
Date
Msg-id CAM3SWZRGoMwH=pdmsE-1V5x-E-mKz1mE4rBL8N=Yz_N9dk0NDA@mail.gmail.com
Whole thread Raw
In response to Re: Turning off HOT/Cleanup sometimes  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Wed, Apr 15, 2015 at 6:10 AM, Andres Freund <andres@anarazel.de> wrote:
>> > Of
>> > course, that applies in all cases, but when the page is already dirty,
>> > the cost of pruning it is probably quite small - we're going to have
>> > to write the page anyway, and pruning it before it gets evicted
>> > (perhaps even by our scan) will be cheaper than writing it now and
>> > writing it again after it's pruned.  When the page is clean, the cost
>> > of pruning is significantly higher.
>>
>> "We" aren't going to have to write the page, but someone will.
>
> If it's already dirty that doesn't change at all. *Not* pruning in that
> moment actually will often *increase* the total amount of writes to the
> OS. Because now the pruning will happen on the next write access or
> vacuum - when the page already might have been undirtied.
>
> I don't really see the downside to this suggestion.

+1. I think, in general, the opportunity cost of not pruning when a
page is already dirty is likely to be rather high. In general, it's
likely to be worth it.


-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Lukas Fittl
Date:
Subject: Re: reparsing query
Next
From: Michael Paquier
Date:
Subject: Re: TAP tests of pg_rewind not stopping servers used for the tests