Skip to content

Instantly share code, notes, and snippets.

@andrefreitas
Created September 25, 2019 15:10
Show Gist options
  • Save andrefreitas/21e8120a9b0a9a7938085220d1442248 to your computer and use it in GitHub Desktop.
Save andrefreitas/21e8120a9b0a9a7938085220d1442248 to your computer and use it in GitHub Desktop.
Postgres Admin Quickies

Find if a query is blocked by another

select pid,
       usename,
       pg_blocking_pids(pid) as blocked_by,
       query as blocked_query
from pg_stat_activity
where cardinality(pg_blocking_pids(pid)) > 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment