Skip to content

Instantly share code, notes, and snippets.

@source-c
Created September 22, 2022 12:40
Show Gist options
  • Save source-c/b683d97ab5b32bb513278228b4e23254 to your computer and use it in GitHub Desktop.
Save source-c/b683d97ab5b32bb513278228b4e23254 to your computer and use it in GitHub Desktop.
PG show locks across all tables/queries
select
relname as relation_name,
query,
pg_locks.*
from pg_locks
join pg_class on pg_locks.relation = pg_class.oid
join pg_stat_activity on pg_locks.pid = pg_stat_activity.pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment