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. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general