Skip to content

Instantly share code, notes, and snippets.

@prakashpp
Created August 30, 2015 06:49
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 prakashpp/e8d6ff95d1f26e5b3f97 to your computer and use it in GitHub Desktop.
Save prakashpp/e8d6ff95d1f26e5b3f97 to your computer and use it in GitHub Desktop.
Postgres all connections except one IP
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
client_addr <> '172.31.1.200'
AND datname = 'staging'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment