Re: Correct query to check streaming replication lag

From: Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
To: Granthana Biswas <granthana(at)zedo(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-21 03:41:48
Message-ID: CADp-Sm7KbvuOcyGBSDvGw+3DcmtAXpBBk4kpHVVYXn3DJfKP2w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jan 20, 2014 at 1:53 PM, Granthana Biswas <granthana(at)zedo(dot)com>wrote:

> Yes we already do that. Count the number of ready wal files.

I guess a better place to check would be pg_stat_replication

Check this discussion:
http://www.postgresql.org/message-id/4F13ED11.6080001@gmail.com

Another way is explained in wiki:
http://wiki.postgresql.org/wiki/Streaming_Replication

$ psql -c "SELECT pg_current_xlog_location()" -h192.168.0.10 (primary host)
pg_current_xlog_location
--------------------------
0/2000000
(1 row)

$ psql -c "select pg_last_xlog_receive_location()" -h192.168.0.20 (standby host)
pg_last_xlog_receive_location
-------------------------------
0/2000000
(1 row)

$ psql -c "select pg_last_xlog_replay_location()" -h192.168.0.20 (standby host)
pg_last_xlog_replay_location
------------------------------
0/2000000
(1 row)

Best Regards,
*Sameer Kumar | Database Consultant*

*ASHNIK PTE. LTD.*101 Cecil Street, #11-11 Tong Eng Building, Singapore
069533
M : *+65 8110 0350* T: +65 6438 3504 | www.ashnik.com
www.facebook.com/ashnikbiz | www.twitter.com/ashnikbiz

[image: email patch]

This email may contain confidential, privileged or copyright material and
is solely for the use of the intended recipient(s).

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Paquier 2014-01-21 04:12:29 Re: Correct query to check streaming replication lag
Previous Message bricklen 2014-01-21 03:41:34 Re: Filtering queries by IP