Skip to content

Instantly share code, notes, and snippets.

@dedunumax
Created February 6, 2020 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dedunumax/a0542b83d4d672eabbf7a17a8ed9dac3 to your computer and use it in GitHub Desktop.
Save dedunumax/a0542b83d4d672eabbf7a17a8ed9dac3 to your computer and use it in GitHub Desktop.
SELECT
pid,
now() - pg_stat_activity.query_start AS duration,
query,
state
FROM pg_stat_activity
WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes'
ORDER BY duration DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment