Skip to content

Instantly share code, notes, and snippets.

@aherok
Created April 11, 2014 13:01
Show Gist options
  • Save aherok/10466934 to your computer and use it in GitHub Desktop.
Save aherok/10466934 to your computer and use it in GitHub Desktop.
display locking queries in pqsql. experimental.
SELECT
bl.transactionid,
bl.mode,
ka.query,
ka.query_start,
ka.state_change,
ka.state,
ka.pid
FROM pg_locks bl
JOIN pg_catalog.pg_locks kl ON kl.transactionid = bl.transactionid
JOIN pg_catalog.pg_stat_activity ka ON ka.pid = kl.pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment