psql -d appdb -c "SELECT * FROM pg_locks WHERE NOT granted;"
Show locks waiting to be granted
pg_locks lists every lock in the cluster; rows with NOT granted are requests still waiting for another session to release a lock. Match on the same relation and lock type to find the holder, then decide whether to cancel or terminate it.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.