Re: finding changed blocks using WAL scanning

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: finding changed blocks using WAL scanning
Date: 2019-04-23 17:01:29
Message-ID: 20190423170129.j45goithtu5ssdxz@development
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 23, 2019 at 09:34:54AM -0700, Andres Freund wrote:
>Hi,
>
>On 2019-04-23 18:07:40 +0200, Tomas Vondra wrote:
>> Well, the thing is that for prefetching to be possible you actually have
>> to be a bit behind. Otherwise you can't really look forward which blocks
>> will be needed, right?
>>
>> IMHO the main use case for prefetching is when there's a spike of activity
>> on the primary, making the standby to fall behind, and then hours takes
>> hours to catch up. I don't think the cases with just a couple of MBs of
>> lag are the issue prefetching is meant to improve (if it does, great).
>
>I'd be surprised if a good implementation didn't. Even just some smarter
>IO scheduling in the startup process could help a good bit. E.g. no need
>to sequentially read the first and then the second block for an update
>record, if you can issue both at the same time - just about every
>storage system these days can do a number of IO requests in parallel,
>and it nearly halves latency effects. And reading a few records (as in a
>few hundred bytes commonly) ahead, allows to do much more than that.
>

I don't disagree with that - prefetching certainly can improve utilization
of the storage system. The question is whether it can meaningfully improve
performance of the recovery process in cases when it does not lag. And I
think it can't (perhaps with remote_apply being an exception).

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-04-23 17:05:03 Re: Regression test PANICs with master-standby setup on same machine
Previous Message Andres Freund 2019-04-23 16:34:54 Re: finding changed blocks using WAL scanning