Re: log XLogPrefetch stats at end of recovery

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Lakshmi N <lakshmin(dot)jhs(at)gmail(dot)com>
Cc: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: log XLogPrefetch stats at end of recovery
Date: 2026-03-25 03:23:07
Message-ID: CALj2ACVi1OtetQ_xNfvTMCWSFqS0FPvBosj-w4WJR0GyEnMPGA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Mar 24, 2026 at 5:07 AM Lakshmi N <lakshmin(dot)jhs(at)gmail(dot)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)

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2026-03-25 03:25:07 Re: relfilenode statistics
Previous Message getiancheng 2026-03-25 03:22:30 Re: [PATCH] Fix premature timeout in pg_promote() caused by signal interruptions