서버/DB

postgresql lock 테이블 조회 및 kill

아카이sun 2023. 4. 19. 14:45

lock 테이블 조회

select  
	b.relname,
	a.locktype,
	page,
	virtualtransaction,
	pid,
	mode,
	granted
from pg_locks a, pg_stat_all_tables b
where a.relation = b.relid
order by relation asc;

process kill

select pg_cancel_backend(pid);