Skip to content

Instantly share code, notes, and snippets.

@maxdanilov
Last active November 18, 2016 22:18
Show Gist options
  • Save maxdanilov/85022c472e585ca3a70a6697d16d468f to your computer and use it in GitHub Desktop.
Save maxdanilov/85022c472e585ca3a70a6697d16d468f to your computer and use it in GitHub Desktop.
[PostgreSQL] Replication lag between primary and replica (in bytes)
SELECT client_addr, pg_xlog_location_diff(pg_stat_replication.sent_location, pg_stat_replication.replay_location) AS byte_lag FROM pg_stat_replication;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment