Created
April 24, 2015 14:14
-
-
Save erichummel/c4ab294d0db7601a5fe9 to your computer and use it in GitHub Desktop.
SQL for identifying/killing hanging queries
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 count(*) from pg_stat_activity where state = 'active' and query not ilike '%stat_activity%'; | |
SELECT pg_cancel_backend(pid) FROM pg_stat_activity where state='active' and query not ilike '%stat_activity%'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment