1、pg慢sql查询
select pid,client_addr,query from pg_stat_activity where state<>'idle' and now()-query_start > interval '10000 ms' order by query_start;
2、杀掉慢sql
select pg_terminate_backend(pid);
pid就是sql的pid。