RE: [Todo item] Add entry creation timestamp column to pg_stat_replication

myungkyu.lim <myungkyu.lim@samsung.com>

From: "myungkyu.lim" <myungkyu.lim@samsung.com>
To: "'Surafel Temesgen'" <surafel3000@gmail.com>
Cc: "'PostgreSQL Hackers'" <pgsql-hackers@postgresql.org>
Date: 2018-11-15T05:10:21Z
Lists: pgsql-hackers
Hi.
Thanks for your feedback.

> Can you explain the purpose of this feature more because now we have columns to report replication delay times like write_lag ,flush_lag and replay_lag that can use for similar purpose .

I think, time elapsed stats are very useful on DML query active system, 
but not present that stats on idle system - not query, or only select.

sent_lsn           | 0/5476C88
write_lsn          | 0/5476C88
flush_lsn          | 0/5476C88
replay_lsn         | 0/5476C88
write_lag          | 00:00:00.000055
flush_lag          | 00:00:00.000855
replay_lag         | 00:00:00.000914
sync_priority      | 0
sync_state         | async
last_msg_send_time | 2018-11-15 14:04:39.65889+09

state              | streaming
sent_lsn           | 0/5476CC0
write_lsn          | 0/5476CC0
flush_lsn          | 0/5476CC0
replay_lsn         | 0/5476CC0
write_lag          |
flush_lag          |
replay_lag         |
sync_priority      | 0
sync_state         | async
last_msg_send_time | 2018-11-15 14:05:02.935457+09

state              | streaming
sent_lsn           | 0/5476CC0
write_lsn          | 0/5476CC0
flush_lsn          | 0/5476CC0
replay_lsn         | 0/5476CC0
write_lag          |
flush_lag          |
replay_lag         |
sync_priority      | 0
sync_state         | async
last_msg_send_time | 2018-11-15 14:06:23.128947+09

This timestamp column is useful when react interval check and debugging on idle system.

Best regards,
Myungkyu, Lim



Commits

  1. Add timestamp of last received message from standby to pg_stat_replication