PostgreSQL 9.2 及以下版本:
SELECT pid, application_name, client_addr, client_port, state, sync_state, (pg_xlog_location_diff(sent_location,flush_location) / 1024)::bigint as receiving_lag, (pg_xlog_location_diff(flush_location,replay_location) / 1024)::bigint as replaying_lag, (pg_xlog_location_diff(pg_stat_replication.sent_location, pg_stat_replication.replay_location) / 1024)::bigint as replication_byte_lag FROM pg_stat_replication