Skip to content

Instantly share code, notes, and snippets.

@spenoir
Created October 4, 2013 12:30
Show Gist options
  • Save spenoir/6825181 to your computer and use it in GitHub Desktop.
Save spenoir/6825181 to your computer and use it in GitHub Desktop.
disconnect open connections on a postgres db
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '<DB_NAME>' AND pid <> pg_backend_pid();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment