Re: Any way to get timestamp from LSN value ?

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Harinath Kanchu <hkanchu(at)apple(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Any way to get timestamp from LSN value ?
Date: 2022-07-28 14:23:54
Message-ID: CALj2ACVgFvOQQEoyuuZeceQrStGsePWvU1noU5aAvJNenv8qTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 28, 2022 at 1:17 PM Harinath Kanchu <hkanchu(at)apple(dot)com> wrote:
>
> Hello,
>
> Is there any way to get the timestamp of the transaction using LSN value ?
>
> For example:
> can we use the minimum recovery ending location in pg control file to get the minimum recovery timestamp ?
>
> Minimum recovery ending location: 28/28000B68

Can't pg_waldump be used? If you are on PG 15, you could as well use
pg_walinspect functions, something like below:

select * from pg_get_wal_records_info_till_end_of_wal(<<start_lsn>>)
where record_type like '%COMMIT%'

[1] https://www.postgresql.org/docs/15/pgwalinspect.html

--
Bharath Rupireddy
RDS Open Source Databases: https://aws.amazon.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-07-28 14:24:51 How come drongo didn't fail authentication here?
Previous Message Julien Rouhaud 2022-07-28 14:19:28 Re: small windows psqlrc re-wording