Skip to content

Instantly share code, notes, and snippets.



Created Dec 14, 2016
What would you like to do?
Postgres util-requests
Drop all connections
SELECT pg_terminate_backend(
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET_DB'
AND pid <> pg_backend_pid();
Show all connections
select *
from pg_stat_activity
where datname = 'mydatabasename'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment