Created
July 17, 2020 09:33
-
-
Save QuittyMR/9dc337908eb449faef66caeb3e3418c2 to your computer and use it in GitHub Desktop.
Retrieve locks from a Postgres DB
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 pg_stat_activity.pid, | |
pg_stat_activity.usename, | |
pg_blocking_pids(pg_stat_activity.pid) AS blocked_by, | |
pg_stat_activity.query AS blocked_query | |
FROM pg_stat_activity | |
WHERE cardinality(pg_blocking_pids(pg_stat_activity.pid)) > 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment