Last active
September 29, 2017 17:28
-
-
Save bitdivine/4047518bb2c48ae59a9262cf2f722cb4 to your computer and use it in GitHub Desktop.
View of the current table locks in postgres and the queries holding them.
This file contains hidden or 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
| CREATE VIEW inf_locks AS | |
| SELECT locktype, relation::regclass, mode, transactionid AS tid, | |
| virtualtransaction AS vtidi, usename, pid, granted, query | |
| FROM pg_catalog.pg_locks l LEFT JOIN pg_catalog.pg_database db | |
| ON db.oid = l.database left join pg_stat_activity using (pid) WHERE (db.datname = 'blue' OR db.datname IS NULL) | |
| AND NOT pid = pg_backend_pid(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment