Re: Add last commit LSN to pg_last_committed_xact()

From: James Coleman <jtc331(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add last commit LSN to pg_last_committed_xact()
Date: 2022-01-18 23:31:42
Message-ID: CAAaqYe8m0pm+EBB65ENuKfkyV6e52Xpr7auUq0WTZ5_e1hY8aA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 18, 2022 at 4:32 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> I wonder if a very different approach could make sense here. Presumably this
> wouldn't need to be queried at a very high frequency, right? If so, what about
> storing the latest commit LSN for each backend in PGPROC? That could be
> maintained without a lock/atomics, and should be just about free.
> pg_last_committed_xact() then would have to iterate over all PGPROCs to
> complete the LSN, but that's not too bad for an operation like that. We'd also
> need to maintain a value for all disconnected backends, but that's also not a hot
> path.

One other question on this: if we went with this would you expect a
new function to parallel pg_last_committed_xact()? Or allow the xid
and lsn in the return of pg_last_committed_xact() potentially not to
match (of course xid might also not be present if
track_commit_timestamps isn't on)? Or would you expect the current xid
and timestamp use the new infrastructure also?

Thanks,
James Coleman

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rafi Shamim 2022-01-18 23:33:20 Re: is ErrorResponse possible on Sync?
Previous Message Hsu, John 2022-01-18 23:30:37 Synchronizing slots from primary to standby