Re: log XLogPrefetch stats at end of recovery

From: Lakshmi N <lakshmin(dot)jhs(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(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-26 08:06:37
Message-ID: CA+3i_M-nu4GcVf6NHf_M5p_-rY2ag7hO8aMfiPRhAB57UwBLZg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Mar 24, 2026 at 8:23 PM Bharath Rupireddy <
bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:

> 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)
>

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 Content-Type Size
v3-0001-xlogprefetcher-redo-stats-logging.patch application/octet-stream 2.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2026-03-26 08:23:54 Re: Adding REPACK [concurrently]
Previous Message Ashutosh Sharma 2026-03-26 07:48:43 Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication