Created
February 14, 2020 07:24
-
-
Save devzer01/95e6b3ef65b0c88fa6be404ee760ebae to your computer and use it in GitHub Desktop.
killing postgresql sessions
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
-- this query kills any active session attached to the 'dbname' database, which can prevent you from | |
-- running certain administrative operations on the database | |
select pg_terminate_backend(pid) | |
from pg_stat_activity | |
where pid IN (select pid from pg_stat_activity where datname = 'dbname'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment