Skip to content

Instantly share code, notes, and snippets.

@nickrw
Created March 10, 2017 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickrw/61ba8e8ad06e861e9aedd9c988c4f27e to your computer and use it in GitHub Desktop.
Save nickrw/61ba8e8ad06e861e9aedd9c988c4f27e to your computer and use it in GitHub Desktop.
A query for showing the locks in a postgres db
SELECT t.relname, l.locktype, page, virtualtransaction, pid, mode, granted
FROM pg_locks l, pg_stat_all_tables t
WHERE l.relation=t.relid
ORDER BY relation ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment