Skip to content

Instantly share code, notes, and snippets.

@Nick011
Created May 13, 2019 15:51
Show Gist options
  • Save Nick011/763bf8fc33d293e272c29d74cbfc17b9 to your computer and use it in GitHub Desktop.
Save Nick011/763bf8fc33d293e272c29d74cbfc17b9 to your computer and use it in GitHub Desktop.
SELECT a.datname,
l.relation::regclass,
l.transactionid,
l.mode,
l.GRANTED,
a.usename,
a.query,
a.query_start,
age(now(), a.query_start) AS "age",
a.pid
FROM pg_stat_activity a
JOIN pg_locks l ON l.pid = a.pid
ORDER BY a.query_start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment