Обсуждение: Any way to get timestamp from LSN value ?

Поиск
Список
Период
Сортировка

Any way to get timestamp from LSN value ?

От
Harinath Kanchu
Дата:
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


Thanks in advance,

Best,
Harinath.

Re: Any way to get timestamp from LSN value ?

От
Bharath Rupireddy
Дата:
On Thu, Jul 28, 2022 at 1:17 PM Harinath Kanchu <hkanchu@apple.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/