Created
August 4, 2015 23:36
-
-
Save inklesspen/12a4a9dec2a8fad40423 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select blocking_sa.query, pg_class.relname | |
from pg_stat_activity as blocking_sa | |
join pg_locks as blocking_locks on blocking_sa.pid = blocking_locks.pid | |
join pg_class on blocking_locks.relation = pg_class.oid | |
join pg_locks as blocked_locks on blocked_locks.relation = blocking_locks.relation | |
join pg_stat_activity as blocked_sa on blocked_locks.pid = blocked_sa.pid | |
where blocking_locks.granted is true and blocked_sa.waiting is true and blocking_sa.waiting is false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment