Re: Add pg_walinspect function with block info columns

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, melanieplageman(at)gmail(dot)com, boekewurm+postgres(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add pg_walinspect function with block info columns
Date: 2023-03-30 22:25:45
Message-ID: CAH2-Wz=s17Y=DkQBJZTJY2J4c9nNRZQz=epR4riPuGnF8=y8Vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 30, 2023 at 2:41 PM Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> pg(at)regression:5432 [1402115]=# SELECT
> count(*)
> FROM
> pg_get_wal_block_info ('0/10E9D80', 'FFFFFFFF/FFFFFFFF', true);
> ┌─[ RECORD 1 ]───────┐
> │ count │ 17,031,979 │
> └───────┴────────────┘
>
> Time: 15235.499 ms (00:15.235)
>
> This time is also typical of what I saw. The variance was fairly low,
> so I won't bother describing it.

If I rerun the same test case with pg_get_wal_records_info (same WAL
records, same system) then I find that it takes about 16 and a half
seconds. So my patch makes pg_get_wal_block_info a little bit faster
than pg_get_wal_records_info for this test case, and likely many
interesting cases (assuming that the user opts out of fetching
block_data and block_fpi_data values when running
pg_get_wal_block_info, per the patch).

This result closely matches what I was expecting. We're doing almost
the same amount of work when each function is called, so naturally the
runtime almost matches. Note that pg_get_wal_records_info does
slightly *more* work here, since it alone must output rows for commit
records. Unlike pg_get_wal_block_info, which (by design) never outputs
rows for WAL records that lack block references.

--
Peter Geoghegan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2023-03-30 22:30:43 Re: Support logical replication of DDLs
Previous Message Peter Geoghegan 2023-03-30 21:41:58 Re: Add pg_walinspect function with block info columns