Re: Measurin the lag between a master and a replica

Поиск
Список
Период
Сортировка
От David Kerr
Тема Re: Measurin the lag between a master and a replica
Дата
Msg-id 9588A29E-845C-42A0-9E42-51A90A3276E0@mr-paradox.net
обсуждение исходный текст
Ответ на Measurin the lag between a master and a replica  (Ali Pouya <alipouya2@gmail.com>)
Ответы Re: Measurin the lag between a master and a replica  (Sergey Konoplev <sergey.konoplev@postgresql-consulting.com>)
Список pgsql-admin
On Jul 19, 2012, at 8:17 AM, Ali Pouya wrote:

> Hi,
> 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
functionreturning 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()
    then 0
    else extract ('epoch' from now()-pg_last_xact_replay_timestamp()) end as log_delay;



В списке pgsql-admin по дате отправления:

Предыдущее
От: "Umer Asghar"
Дата:
Сообщение: Postgres Database got down
Следующее
От: "Madhu.Lanka"
Дата:
Сообщение: ERROR: there is no parameter $1