Hvis du kører PostgreSQL 9.6+, kan du bruge pg_blocking_pids()
for at finde PID for forespørgsler, der låser din.
select pid, pg_blocking_pids(pid) as blocked_by, query as blocked_query
from pg_stat_activity
where pg_blocking_pids(pid)::text != '{}';