Skip to content

Instantly share code, notes, and snippets.

@forgotpw1
Last active August 29, 2015 14:18
Show Gist options
  • Save forgotpw1/4c2792a0c878d41c32ba to your computer and use it in GitHub Desktop.
Save forgotpw1/4c2792a0c878d41c32ba to your computer and use it in GitHub Desktop.
Find out which database tables are locked
SELECT relation, transaction, pid, mode, granted, relname
FROM pg_locks
INNER JOIN pg_stat_user_tables
ON pg_locks.relation = pg_stat_user_tables.relid
WHERE pg_locks.pid='pid';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment