Determining replication lag

From: rakeshkumar464 <rakeshkumar464(at)outlook(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Determining replication lag
Date: 2016-12-02 15:26:20
Message-ID: 1480692380242-5933003.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I found the following SQL in stackoverflow:

SELECT
pg_last_xlog_receive_location() receive,
pg_last_xlog_replay_location() replay,
(
extract(epoch FROM now()) -
extract(epoch FROM pg_last_xact_replay_timestamp())
)::int lag

I get different result in primary and slave. On primary the col lag always
shows some number, usually more than 3000, but on slave it is always zero.
Why the discrepancy ?

--
View this message in context: http://postgresql.nabble.com/Determining-replication-lag-tp5933003.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2016-12-02 15:33:12 Re: Full text search randomly not working for short prefixes?
Previous Message cen 2016-12-02 15:21:58 Full text search randomly not working for short prefixes?