Re: Correct query to check streaming replication lag

From: Granthana Biswas <granthana(at)zedo(dot)com>
To: Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
Cc: PostgreSQL General Discussion Forum <pgsql-general(at)postgresql(dot)org>
Subject: Re: Correct query to check streaming replication lag
Date: 2014-01-17 10:07:56
Message-ID: CAACh-pVNvCjs0A0LUa6sKiYHn3nmoUcy8UJK_v_rwyDZRMnCFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yes it's purely for monitoring purpose.

Regards,
Granthana

On Fri, Jan 17, 2014 at 3:29 PM, Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>wrote:

>
>
> On Fri, Jan 17, 2014 at 5:31 PM, Granthana Biswas <granthana(at)zedo(dot)com>wrote:
>
>>
>>
>> Thank you Sameer for your reply. Is there any other query that would help
>> get exact replication lag?
>>
>>
> You 2nd Query is the most accurate you can get.
>
>
>> 2. 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()) END AS log_delay;
>>>
>>> For reason same as above, this won't be exact but the most accurate you
>>> can get.
>>>
>>> You can get lags in terms of bytes (and I have always believed that
> makes more sense).
>
>
> May I ask, why are you looking for this info? Is it purely monitoring?
>
> Regards
> Sameer
> Ashnik Pte Ltd.
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ray Stell 2014-01-17 14:54:04 Re: Correct query to check streaming replication lag
Previous Message Sameer Kumar 2014-01-17 09:59:27 Re: Correct query to check streaming replication lag