Skip to content

Instantly share code, notes, and snippets.

@tokenvolt
Created July 16, 2014 15:23
Show Gist options
  • Save tokenvolt/4a87aba58dfbc47242f0 to your computer and use it in GitHub Desktop.
Save tokenvolt/4a87aba58dfbc47242f0 to your computer and use it in GitHub Desktop.
Drop postgres connections for specific DB
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