Skip to content

Instantly share code, notes, and snippets.

@marcelolebre
Created September 17, 2016 15:38
Show Gist options
  • Save marcelolebre/c15ee61033baa541579727f460d54312 to your computer and use it in GitHub Desktop.
Save marcelolebre/c15ee61033baa541579727f460d54312 to your computer and use it in GitHub Desktop.
drop postgres sessions
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