Last active
August 29, 2015 14:05
-
-
Save biske/6bf1e3a02e188850bcd6 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
-- To mark database 'applogs' as not accepting new connections: | |
update pg_database set datallowconn = false where datname = 'TARGET_DB'; | |
/* Query pg_stat_activity and get the pid values you want to kill, | |
then issue SELECT pg_terminate_backend(pid int) to them. */ | |
SELECT pg_terminate_backend(pg_stat_activity.pid) | |
FROM pg_stat_activity | |
WHERE pg_stat_activity.datname = 'TARGET_DB' | |
AND pid <> pg_backend_pid(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment