select * from pg_stat_activity where datname = 'datname' and waiting_reason = 'lock';
根据查询结果中的pid值杀掉进程 select pg_terminate_backend(pid)