|From:||David Kerr <dmk(at)mr-paradox(dot)net>|
|To:||Ali Pouya <alipouya2(at)gmail(dot)com>|
|Subject:||Re: Measurin the lag between a master and a replica|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
On Jul 19, 2012, at 8:17 AM, Ali Pouya wrote:
> I am using a master and a replica with PostgreSQL 9.1.3.
> I would like to measure the replication lag between my servers (in time units).
> On the replica I can use the function pg_last_xact_replay_timestamp().
> But on the master I only can use pg_current_xlog_location() which does not return a timestamp. I do not know any function returning the timestamp.
> Is there any way to get the timestamp relative to the result of pg_current_xlog_location() ?
> Thanks for your help
> Best regards
> Ali Pouya
I was looking into this last month and some nice folks on the list pointed me to this formula
for calculating lag. (to be run on the slave) similar to what Sergey said.
when pg_last_xlog_receive_location() = pg_last_xlog_replay_location()
else extract ('epoch' from now()-pg_last_xact_replay_timestamp()) end as log_delay;
|Next Message||Madhu.Lanka||2012-07-20 02:33:36||ERROR: there is no parameter $1|
|Previous Message||Umer Asghar||2012-07-19 16:19:39||Postgres Database got down|