Skip to content

Instantly share code, notes, and snippets.

@riethmayer
Created August 18, 2014 13:15
Show Gist options
  • Save riethmayer/6f224183fbee407f8eeb to your computer and use it in GitHub Desktop.
Save riethmayer/6f224183fbee407f8eeb to your computer and use it in GitHub Desktop.
SELECT
pid,
datname,
query,
EXTRACT(EPOCH FROM (NOW() - query_start)) AS duration
FROM pg_stat_activity
WHERE state='active'
ORDER BY query_start ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment