Skip to content

Instantly share code, notes, and snippets.

@oniksfly
Last active August 16, 2017 08:38
Show Gist options
  • Save oniksfly/e8ee004b2d4a637b640930734a075c7c to your computer and use it in GitHub Desktop.
Save oniksfly/e8ee004b2d4a637b640930734a075c7c to your computer and use it in GitHub Desktop.
Terminate postres DB connections
psql -c "SELECT *, pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND datname = 'DATABASE_NAME'"
@oniksfly
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment