Skip to content

Instantly share code, notes, and snippets.

@adhpawal
Created April 11, 2018 07:22
Show Gist options
  • Save adhpawal/b048ece231aa8aa44d3643607c79fc01 to your computer and use it in GitHub Desktop.
Save adhpawal/b048ece231aa8aa44d3643607c79fc01 to your computer and use it in GitHub Desktop.
Kill Database Process Postgresql
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
-- don't kill my own connection!
pid <> pg_backend_pid()
-- don't kill the connections to other databases
AND datname = 'database_name'
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment