PostgreSQL

查询ACTIVITY的状态等信息

select *  from PG_STAT_ACTIVITY where datname = 'dbname';

查询死锁的ACTIVITY

select *  from PG_STAT_ACTIVITY where datname = 'dbname' and waiting = 't';

通过pid解锁对应的ACTIVITY

select PG_CANCEL_BACKEND('6984');