Created
September 22, 2022 12:36
-
-
Save source-c/6d390eda41f952fdd8fad7961183d9ba to your computer and use it in GitHub Desktop.
PG list blocked queries/clients
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 | |
activity.pid, | |
activity.usename, | |
activity.query, | |
blocking.pid AS blocking_id, | |
blocking.query AS blocking_query | |
FROM pg_stat_activity AS activity | |
JOIN pg_stat_activity AS blocking ON blocking.pid = ANY(pg_blocking_pids(activity.pid)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment