W
W
WildZero2014-04-22 12:49:11
PostgreSQL
WildZero, 2014-04-22 12:49:11

How can you calculate the master-slave replication latency. postgres 9.2.7?

How can I calculate master-slave replication latency in postgres?
I get the value of the lag, but this value is quite abstract, I would like to get exactly the delay time.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Lesovsky, 2014-04-22
@lesovsky

select now() - pg_last_xact_replay_timestamp();
run on standby via psql, get the lag in seconds.

V
Vlad Zhivotnev, 2014-04-22
@inkvizitor68sl

Mhm. There is one universal way for all bases.
In a separate table on the master every second-five-ten (depending on the desired error and load) write the current time. And on the replica, check how much this table lags behind real time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question