Skip to content

Instantly share code, notes, and snippets.

@marcelolebre
Created January 7, 2015 14:52
Show Gist options
  • Save marcelolebre/0879696337841ae716f4 to your computer and use it in GitHub Desktop.
Save marcelolebre/0879696337841ae716f4 to your computer and use it in GitHub Desktop.
Terminating Connections on PSQL
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET_DB'
AND pid <> pg_backend_pid();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment