On 6 July 2015 at 15:35, Alberto Olivares
<alberto.olivares@snowflakesoftware.com> wrote:
> Hi Matheus,
>
>
> Thanks for your answer. I do not have access to the primary database. So, I
> cannot run a SQL in there.
>
> I need to run the command in the Slave database that tells me whether the
> replication is still working or not.
"SELECT pg_last_xact_replay_timestamp()" gives you the time of the
last write. If it is not increasing, replication is broken or the
primary is idle. If it is NULL, the database is a primary or a
secondary just starting up. I think most of our are monitoring that
lag time is in a certain range - "SELECT (now() -
pg_last_xact_replay_timestamp()) < '5 minutes'::interval"
--
Stuart Bishop <stuart@stuartbishop.net>
http://www.stuartbishop.net/