PostgreSQL 查询被锁阻塞的连接
作者:互联网
主要是查pg_lock,再结合pg_stat_activity和pg_class,我用的SQL是:
select relation::regclass, s.pid, granted, client_hostname, application_name, usename, query from pg_locks l, pg_stat_activity s where s.pid = l.pid;
可以根据查出来的pid或客户端,找到阻塞的连接和进程,手动杀掉
SELECT pg_cancel_backend(<pid>);
强制结束进程
SELECT pg_terminate_backend(11929);
原文链接:https://blog.csdn.net/howard_shooter/article/details/122063644
标签:stat,PostgreSQL,pid,阻塞,查询,pg,activity,SELECT,backend 来源: https://www.cnblogs.com/ithubb/p/16135720.html