Re: log XLogPrefetch stats at end of recovery - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: log XLogPrefetch stats at end of recovery
Date
Msg-id CALj2ACVi1OtetQ_xNfvTMCWSFqS0FPvBosj-w4WJR0GyEnMPGA@mail.gmail.com
Whole thread Raw
In response to Re: log XLogPrefetch stats at end of recovery  (Lakshmi N <lakshmin.jhs@gmail.com>)
List pgsql-hackers
Hi,

On Tue, Mar 24, 2026 at 5:07 AM Lakshmi N <lakshmin.jhs@gmail.com> wrote:
>
>> so instead of like:
>> redo prefetch stats: prefetch=%lu, hit=%lu, skip_init=%lu,
>> skip_new=%lu, skip_fpw=%lu, skip_rep=%lu"
>>
>> something like below ones:
>> redo prefetch stats: done %lu prefetches, %lu hit, %lu zero-initated, ..
>> redo prefetch stats: done %lu prefetches, (%d% hit ratio), %lu
>> zero-initated, .. or something like that
>
> Please find the attached patch with the suggested changes. I referenced [1] to log the message as suggested.
>
> 2026-03-24 04:53:15.251 PDT [18898] LOG:  redo prefetch stats: prefetched 27 blocks, skipped 22 blocks because they
werealready in the buffer pool, skipped 17 blocks because they would be zero-initialized, skipped 0 blocks because they
didn'texist yet, skipped 28 blocks because a full page image was included in the WAL, skipped 155 blocks because they
werealready recently prefetched. 

IMHO, the above looks too verbose. +1 for Jakub's suggestion. Would
something like the below work? I believe the developers looking at
these logs for analysis will have some understanding of what each of
these means.

LOG: redo prefetch stats: prefetched 27, skipped (22 in buffer pool,
17 zero-inited, 0 non-existent, 28 FPI, 155 recently prefetched)

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: getiancheng
Date:
Subject: Re: [PATCH] Fix premature timeout in pg_promote() caused by signal interruptions
Next
From: Bertrand Drouvot
Date:
Subject: Re: relfilenode statistics