Created
June 14, 2021 07:03
-
-
Save i-e-b/703241ec230ad4824a4d51687163396d to your computer and use it in GitHub Desktop.
Postgresql: Disconnect other users
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
-- Disconnect any stray connections (like from background tasks) | |
SELECT | |
pg_terminate_backend(pid) | |
FROM | |
pg_stat_activity | |
WHERE -- don't kill my own connection! | |
pid <> pg_backend_pid(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment