SELECT client_addr,
pg_wal_lsn_diff(A .c1, replay_lsn) (1024 * 1024) AS slave_latency_MB,
pg_wal_lsn_diff(A .c1, sent_lsn) /(1024 * 1024) AS send_latency_MB,
pg_wal_lsn_diff(A .c1, flush_lsn) /(1024 * 1024) AS flush_latency_MB,
state,
backend_start,
now()::timestamp with time zone
FROM pg_stat_replication, pg_current_wal_lsn() AS A(c1)
ORDER BY slave_latency_MB, send_latency_MB DESC;
SELECT client_addr,
pg_xlog_location_diff(A .c1, replay_location) /(1024 * 1024) AS slave_latency_MB,
pg_xlog_location_diff(A .c1, sent_location) /(1024 * 1024) AS send_latency_MB,
pg_xlog_location_diff(A .c1, flush_location) /(1024 * 1024) AS flush_latency_MB,
state,
backend_start,
now()::timestamp with time zone
FROM pg_stat_replication, pg_current_xlog_location() AS A(c1)
ORDER BY slave_latency_MB, send_latency_MB DESC
LIMIT 1;
$ iftop -i eth0 -n
$ iftop -i eth0 -n -P
$ iftop -i eth0 -n -B
$ iftop -i eth0 -n
$ iftop -i eth0 -n
$ iftop -i eth0 -n
SELECT datname,pid,client_addr,usename,application_name,
clock_timestamp() - query_start,query
FROM pg_stat_activity
WHERE (state = ANY (ARRAY['active'::text, 'idle in transaction'::text])) AND (clock_timestamp() - query_start) > '00:00:60'::interval
ORDER BY (clock_timestamp() - query_start) DESC;
select pg_terminate_backend(pid);

本文作者:胡周盼(上海新炬中北团队)
本文来源:“IT那活儿”公众号

文章转载自IT那活儿,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




