RE: Use WALReadFromBuffers in more places

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Bharath Rupireddy' <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Kirill Reshke <reshkekirill(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Jingtang Zhang <mrdrivingduck(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Nitin Jadhav <nitinjadhavpostgres(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: RE: Use WALReadFromBuffers in more places
Date: 2026-11-26 09:36:39
Message-ID: TY5PR01MB183145CF1BDF4A699AEC7997EF5422@TY5PR01MB18314.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks for updating the patch. I played with your benchmark [1] (with some top-up
fixes). Changed points:

1) Generates WAL records first then read them. Original script does concurrently,
but the command measures the execution time for pg_get_wal_stats.
2) Fix the number of generated WAL record to compare the scan time.

And I got the below result (median of three runs). "WAL-disk reads" cannot be
measured because the decoding time was less than 1 second.

build WAL direct IO TPS scan ms WAL generated MB reader read MB file reads buffer hits WAL-disk reads WAL-disk writes
PATCHED on 2859 626 284 284 36357 1 235 MB/s 24.6 MB/s
PATCHED off 3166 174 284 284 36353 6 0 MB/s 24.8 MB/
HEAD on 2611 634 284 284 36359 0 0 MB/s 24.4 MB/s
HEAD off 7629 106 284 284 36359 0 0 MB/s 27.5 MB/s

I have not analyzed via perf, but the result may show that WAL records cannot be
read from the buffer thus a round trip for WALReadFromBuffers() wasted the time.
Apart from the replication system, local read of WALs like logical decoding via
SQL functions can be done less frequently, I'm afraid that this patch might cause
a performance regression.

how do you feel?

[1]: https://www.postgresql.org/message-id/attachment/206114/nocfbot-local_wal_read_perf.sh

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2026-11-26 09:39:00 Re: new clang warnings about unused global variables
Previous Message Koshino Taiki 2026-11-26 09:36:24 Re: Proposal: Include CHECK constraint expression in violation error DETAIL