Skip to content

Instantly share code, notes, and snippets.

@bernardoVale
Created May 3, 2018 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bernardoVale/19303727a42a80b2e1e4585f5b46b07c to your computer and use it in GitHub Desktop.
Save bernardoVale/19303727a42a80b2e1e4585f5b46b07c to your computer and use it in GitHub Desktop.
Drop Postgres DB
# Run this query
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'target_db'
AND pid <> pg_backend_pid();
DROP DATABASE target_db;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment