Last active
April 26, 2016 10:51
-
-
Save makaroni4/b35cc02800a2a4cae3228ab8e4efa138 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
age(now(), query_start) AS duration, | |
state, | |
pid, | |
query, | |
datname, | |
application_name, | |
waiting | |
FROM pg_stat_activity | |
ORDER BY duration DESC NULLS LAST; | |
SELECT | |
age(now(), query_start) AS duration, | |
state, | |
pid, | |
query, | |
datname, | |
application_name, | |
waiting | |
FROM pg_stat_activity | |
WHERE state = 'active' | |
ORDER BY duration DESC NULLS LAST; | |
SELECT pg_cancel_backend(procpid); | |
SELECT pg_terminate_backend(procpid); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment