Re: Turning off HOT/Cleanup sometimes

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Turning off HOT/Cleanup sometimes
Date: 2015-04-16 01:15:31
Message-ID: CAM3SWZRGoMwH=pdmsE-1V5x-E-mKz1mE4rBL8N=Yz_N9dk0NDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 15, 2015 at 6:10 AM, Andres Freund <andres(at)anarazel(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-04-16 01:16:03 Re: TAP tests of pg_rewind not stopping servers used for the tests
Previous Message Lukas Fittl 2015-04-16 00:19:11 Re: reparsing query