Last active
August 16, 2017 08:38
-
-
Save oniksfly/e8ee004b2d4a637b640930734a075c7c to your computer and use it in GitHub Desktop.
Terminate postres DB connections
This file contains 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
psql -c "SELECT *, pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND datname = 'DATABASE_NAME'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/a/41597543/2417790