Skip to content

Instantly share code, notes, and snippets.

@benjamin658
Last active December 24, 2021 09:37
Show Gist options
  • Save benjamin658/8bc9434b02288be0ac1e622feb957395 to your computer and use it in GitHub Desktop.
Save benjamin658/8bc9434b02288be0ac1e622feb957395 to your computer and use it in GitHub Desktop.
Postgres Viewing locks with table names and 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