【PostgreSQL】表锁死

-- 查看所有进程
SELECT * FROM pg_stat_activity;
-- 查看指定数据库锁死的进程
select * from pg_stat_activity where datname = 'datname' and wait_event_type = 'Lock';
-- 查看某个表被锁表的进程id
select oid from pg_class where relname='tablename';
select pid from pg_locks where relation='oid';
-- 释放锁定
select pg_terminate_backend(pid);

你可能感兴趣的:(【PostgreSQL】表锁死)