Re: master-side counterpart of pg_last_xact_replay_timestamp?

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Chris Redekop <chris(at)replicon(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: master-side counterpart of pg_last_xact_replay_timestamp?
Date: 2011-09-08 05:43:18
Message-ID: CAHGQGwGcuA2Lv06yw-L8FBObdn-nhGYNdqnLz+CwwCgGPR4iRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 8, 2011 at 7:06 AM, Chris Redekop <chris(at)replicon(dot)com> wrote:
> Is there anything available to get the last time a transaction
> occurred?....like say "pg_last_xact_timestamp"?

No.

> In order to accurately
> calculate how far behind my slave is I need to do something like
> master::pg_last_xact_timestamp() -
> slave::pg_last_xact_replay_timestamp()....currently I'm using now() instead
> of the pg_last_xact_timestamp() call, but then when the master is not busy
> the slave appears to lag behind.  I'm considering writing a C module to get
> the last modified file time of the xlog, but I'm hoping there is a better
> alternative that I haven't found yet....

Your complaint makes sense. I'll implement something like
pg_last_xact_timestamp() for 9.2. But unfortunately there is
no way to know such a timestamp on the master, in 9.1..

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Simon Riggs 2011-09-08 06:19:25 Re: master-side counterpart of pg_last_xact_replay_timestamp?
Previous Message Tom Lane 2011-09-08 00:29:07 Re: Lock problem