Created
May 13, 2011 10:49
-
-
Save bonyiii/970337 to your computer and use it in GitHub Desktop.
forcibly kill idle postgresql process
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
| http://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-ADMIN-SIGNAL-TABLE | |
| http://www.postgresql.org/docs/current/static/monitoring-stats.html#MONITORING-STATS-VIEWS | |
| http://stackoverflow.com/questions/727194/force-client-disconnect-using-postgresql | |
| SELECT pg_stat_get_backend_pid(s.backendid) AS procpid, | |
| pg_stat_get_backend_activity(s.backendid) AS current_query | |
| FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s; | |
| # OR | |
| SELECT procpid,current_query from pg_stat_activity WHERE current_query LIKE '<IDLE>'; | |
| SELECT procpid, (SELECT pg_terminate_backend(procpid)) as got_killed from pg_stat_activity WHERE current_query LIKE '<IDLE>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment