Checking Postgres Streaming replication delay

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Checking Postgres Streaming replication delay
Date: 2016-10-31 00:57:52
Message-ID: CAJNY3ivSdN69zSpjrvVgarfRGfpOqDrY4YyfN08Uu2B74X7pSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi guys,

I'm using this query to measure the delay between a Master and a Streaming
Replication Slave server, using PostgreSQL 9.2.

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;

In your opinion, is that right?

Cheers

Patrick

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Venkata B Nagothi 2016-10-31 02:54:23 Re: Checking Postgres Streaming replication delay
Previous Message Samuel Williams 2016-10-31 00:08:19 Re: initdb createuser commands