| From: | Vasilis Ventirozos <v(dot)ventirozos(at)gmail(dot)com> |
|---|---|
| To: | "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
| Subject: | Re: How to determine replication lag |
| Date: | 2014-08-08 08:00:23 |
| Message-ID: | CAF8jcqq=jX-vf2f0iiLn-dyrM2_vQQZCvzhE-BBwvjTAtHCj0Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
try this :
SELECT
client_hostname,
client_addr,
sent_offset - (replay_offset - (sent_xlog - replay_xlog) * 255 * 16
^ 6 ) AS byte_lag
FROM (
SELECT
client_hostname,
client_addr,
('x' || lpad(split_part(sent_location, '/', 1), 8,
'0'))::bit(32)::bigint AS sent_xlog,
('x' || lpad(split_part(replay_location, '/', 1), 8,
'0'))::bit(32)::bigint AS replay_xlog,
('x' || lpad(split_part(sent_location, '/', 2), 8,
'0'))::bit(32)::bigint AS sent_offset,
('x' || lpad(split_part(replay_location, '/', 2), 8,
'0'))::bit(32)::bigint AS replay_offset
FROM pg_stat_replication
) AS s;
Vasilis Ventirozos
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joseph Mays | 2014-08-08 21:20:25 | Postgres-XC, adding a new server to the cluster. |
| Previous Message | Dan Herzog | 2014-08-07 19:59:31 | Re: How to determine replication lag |