Re: Turning off HOT/Cleanup sometimes

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Simon Riggs <simon(at)2ndQuadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Jeff Janes <jeff(dot)janes(at)gmail(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-15 16:19:06
Message-ID: 552E8F7A.40202@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/15/2015 07:11 PM, Alvaro Herrera wrote:
> Heikki Linnakangas wrote:
>> On 04/15/2015 05:44 PM, Alvaro Herrera wrote:
>
>>> Robert's proposal is "when reading a page, if dirty HOT-clean it; if not
>>> dirty, also HOT-clean it but only 5 times in each scan". This runs
>>> HOT-cleanup some number of times (as many as there are dirty), and
>>> causes at most 5 pages to become dirty.
>>>
>>>
>>> Am I right in thinking that HOT-clean in a dirty page is something that
>>> runs completely within CPU cache? If so, it would be damn fast and
>>> would have benefits for future readers, for very little cost.
>>
>> If there are many tuples on the page, it takes some CPU effort to scan all
>> the HOT chains and move tuples around. Also, it creates a WAL record, which
>> isn't free.
>
> But if the page is in CPU cache, the CPU effort shouldn't be all that
> noticeable, should it? That's my point, but then maybe I'm wrong. Now,
> the WAL logging is annoying, so let's limit that too -- do it at most
> for, say, 20 dirty pages and at most 5 clean pages.

There isn't much difference between that and just doing it on first 5
pages. Both of those numbers were pulled out of thin air, anyway. I'd
rather just keep it simple.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2015-04-15 16:23:38 Re: [COMMITTERS] pgsql: Move pg_upgrade from contrib/ to src/bin/
Previous Message Heikki Linnakangas 2015-04-15 16:12:44 Re: Bugs in CreateCheckPoint