Re: How to determine replication lag

Поиск
Список
Период
Сортировка
От Dan Herzog
Тема Re: How to determine replication lag
Дата
Msg-id D577A90562E85348AD1D635F142053ABCFB8E2@exchbesea01.windows.marchex.com
обсуждение исходный текст
Ответ на How to determine replication lag  (Murthy Nunna <mnunna@fnal.gov>)
Ответы Re: How to determine replication lag
Список pgsql-admin
I used the SQL from this link to determine replication lag:

http://www.dansketcher.com/2013/01/27/monitoring-postgresql-streaming-replication/

SELECT
CASE 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;

The one caveat is that if nothing else is committing changes and you have long running transactions that are generating
wal,but have not committed, you will show a replication lag.  As I understand it pg_last_xact_replay_timestamp() shows
thelast committed xact timestamp. 

And Josh Berkus has done some nice write ups on replication lag:

http://www.databasesoup.com/2014/04/simplifying-replication-position.html



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

Предыдущее
От: "Joseph Mays"
Дата:
Сообщение: postgres-xc
Следующее
От: Vasilis Ventirozos
Дата:
Сообщение: Re: How to determine replication lag