Skip to content

Instantly share code, notes, and snippets.

@victorphamdeveloper
Last active November 5, 2018 10:01
Show Gist options
  • Save victorphamdeveloper/bb9433ec8b1786085287d1e8e8429e8e to your computer and use it in GitHub Desktop.
Save victorphamdeveloper/bb9433ec8b1786085287d1e8e8429e8e to your computer and use it in GitHub Desktop.
Delete all pg connections
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