Skip to content

Instantly share code, notes, and snippets.

@Megaprog
Last active September 13, 2022 04:23
Show Gist options
  • Save Megaprog/cfa1203c1d65cc1748b79cc2f73c8aa6 to your computer and use it in GitHub Desktop.
Save Megaprog/cfa1203c1d65cc1748b79cc2f73c8aa6 to your computer and use it in GitHub Desktop.
How to see PG locks with advisory bigint hash
select l.pid, relation::regclass, mode, a.application_name, a.query_start, locktype,
(classid::bigint << 32) | objid::bigint as hash
from pg_locks l join pg_stat_activity a on l.pid = a.pid where granted;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment