Skip to content

Instantly share code, notes, and snippets.

@brannn
Created October 9, 2015 14:51
Show Gist options
  • Select an option

  • Save brannn/82391a64fba4e68d92fd to your computer and use it in GitHub Desktop.

Select an option

Save brannn/82391a64fba4e68d92fd to your computer and use it in GitHub Desktop.
SELECT
datname,
NOW() - query_start AS duration,
procpid,
current_query
FROM
pg_stat_activity
WHERE
current_query <> '<IDLE>'
AND
NOW() - query_start > '1 second'
ORDER BY duration DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment