Last active
November 11, 2019 09:08
-
-
Save ganapathichidambaram/4fd0665563fbd07740e38a4472a7d707 to your computer and use it in GitHub Desktop.
Kill Active Session of Postgresql DB
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
-- SQL : Postgresql | |
-- Query : Kill all the active connection of particular database. | |
SELECT | |
pg_terminate_backend(pid) | |
FROM | |
pg_stat_activity | |
WHERE | |
pid <> pg_backend_pid() | |
AND datname = 'dev'; -- dev- Database Name which connection needs to be terminate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment