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

From Lakshmi N
Subject Re: log XLogPrefetch stats at end of recovery
Date
Msg-id CA+3i_M-nu4GcVf6NHf_M5p_-rY2ag7hO8aMfiPRhAB57UwBLZg@mail.gmail.com
Whole thread Raw
In response to Re: log XLogPrefetch stats at end of recovery  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Responses Re: log XLogPrefetch stats at end of recovery
List pgsql-hackers
Hi,

On Tue, Mar 24, 2026 at 8:23 PM Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> wrote:
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 were already in the buffer pool, skipped 17 blocks because they would be zero-initialized, skipped 0 blocks because they didn't exist yet, skipped 28 blocks because a full page image was included in the WAL, skipped 155 blocks because they were already 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)

Address this in the attached patch. Please let me know if this looks good.
2026-03-26 00:51:19.797 PDT [91881] LOG:  redo prefetch stats: prefetched 418376 blocks, skipped (362419 in the buffer pool, 418479 zero-initialized, 0 non-existent, 9 full page image, 39183318 recently prefetched)
 
Regards,
Lakshmi
Attachment

pgsql-hackers by date:

Previous
From: Ashutosh Sharma
Date:
Subject: Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication
Next
From: Antonin Houska
Date:
Subject: Re: Adding REPACK [concurrently]