Skip to content

Instantly share code, notes, and snippets.

@kenvac
Created August 6, 2018 09:14
Show Gist options
  • Save kenvac/790af6918cccaca3d11088200e8ea3d3 to your computer and use it in GitHub Desktop.
Save kenvac/790af6918cccaca3d11088200e8ea3d3 to your computer and use it in GitHub Desktop.
terminate db connections postgresql 10
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