SELECT * FROM pg_stat_activity WHERE datname='死锁的数据库ID '; SELECT pg_cancel_backend(PID); SELECT pg_terminate_backend(PID);