Skip to content

Instantly share code, notes, and snippets.

@fhgbaguidi
Created January 24, 2023 10:27
Show Gist options
  • Save fhgbaguidi/57bf0c4f7c391e443e35742ee9d3ff4a to your computer and use it in GitHub Desktop.
Save fhgbaguidi/57bf0c4f7c391e443e35742ee9d3ff4a to your computer and use it in GitHub Desktop.
Find blocking postgresql queries
SELECT pid, pg_blocking_pids(pid) AS blocked_by, query AS blocked_query, backend_start
FROM pg_stat_activity
WHERE pg_blocking_pids(pid)::TEXT != '{}';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment