Hi,

On Tue, Nov 17, 2026 at 7:17 PM Chao Li <[email protected]> wrote:
>
> >> During HOW2026 in Jinan this April, a DBA talked to me that PG lacks an 
> >> easy way to locate WAL files by time.
> >
> > I think using the existing pg_walinspect functions, one can look up
> > the times using the transaction commit/abort time from the description
> > column, starting from the last checkpoint's redo LSN till the current
> > flush LSN. Isn't this helpful? It takes a bit of time to do so, but
> > that should be fine.
>
> I'm afraid that's not easy.

I see the value here, and I'm not against the use case. I'm just not
yet convinced it needs new functions in pg_walinspect. Would something
like the attached work? For WAL in pg_wal, the SQL starts from the
oldest kept WAL or the last checkpoint record and reports the time,
LSN etc. And for WAL in the archive, pg_waldump can do something
similar with output filtering.

This example could go in the docs as an example, or on a wiki page
like the bloat queries. Returning the timestamp of the record as a
column would also help, so it doesn't have to be read out of the
description (i.e., less SQL).

That said, I will leave it here and wait for opinions from any
committer or other hackers. Thanks.

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

Attachment: nocfbot-timebased-wal-inspection.sh
Description: Bourne shell script

Reply via email to