Skip to content

Instantly share code, notes, and snippets.

@aaronwalker
Created May 20, 2019 12:09
Show Gist options
  • Select an option

  • Save aaronwalker/fea50e6ff9d3f171facdb6f846ed3eb1 to your computer and use it in GitHub Desktop.

Select an option

Save aaronwalker/fea50e6ff9d3f171facdb6f846ed3eb1 to your computer and use it in GitHub Desktop.
current postgres activity
SELECT max(now() - xact_start) AS duration, pid, state, query FROM pg_stat_activity
WHERE state IN ('idle in transaction', 'active')
GROUP BY pid, query, state ORDER BY duration;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment