Created
August 7, 2017 22:29
-
-
Save ryanpadilha/3df07d3e35237204d316c4f37a227638 to your computer and use it in GitHub Desktop.
Drop all connections to a specific database-name
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
-- PostgreSQL 9.6 | |
-- view connections | |
select * from pg_stat_activity where datname = 'db_name'; | |
-- drop connections | |
select pg_terminate_backend(pid) from pg_stat_activity where datname = 'db_name'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment