Showing deadlocked processes with Postgres
If you need to find out which Postgres processes are blocking your query then you can use the select query like the one below:SELECT
h.pid AS blocker_pid,
w.pid AS blockee_pid
FROM
pg_locks h,
pg_locks w
WHERE
h.granted AND
NOT w.granted AND
(
(h.relation = w.relation AND h.database = w.database)
OR
h.transaction = w.transaction
)
;
Last updated: 02/02/2007