Re: NOTIFY command impact

From: Benoit Lobréau <benoit(dot)lobreau(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Rob Brucks <rob(dot)brucks(at)rackspace(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, François Beaulieu <frank(at)tzone(dot)org>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: NOTIFY command impact
Date: 2017-02-23 15:23:30
Message-ID: CAPE8EZ6Zqbi5Mx+MAEo=dFYk0ngJvBbC6zUudBmq123YBOjJXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I might have missed something.
This should be enough to solve the problem no ?

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())::INTEGER
END
AS replication_lag;

Benoit.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Güttler 2017-02-23 15:25:13 Re: Move rows from one database to other
Previous Message Adrian Klaver 2017-02-23 15:21:38 Re: Foreign key references a unique index instead of a primary key