使用了很多的其他方法,亲测此种方法有效解决死锁问题。
1.您可以使用pg_terminate_backend通过查询终止打开的连接:
PostgresVersion> = 9.2
SELECT
pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE
pg_stat_activity.datname = 'test'
AND pid <> pg_backend_pid()
PostgresVersion <9.2
SELECT
pg_terminate_backend(pg_stat_activity.procpid)
FROM
pg_stat_activity
WHERE
pg_stat_activity.datname = 'test'
AND procpid <> pg_backend_pid();
其中“ test”是您的数据库名称。
标签:stat,postgres,terminate,数据库,pid,pg,activity,锁死,backend From: https://www.cnblogs.com/dongfangzhaoyue/p/16756670.html