Created
May 13, 2011 03:55
-
-
Save tommeier/969941 to your computer and use it in GitHub Desktop.
Close open sql connections in postgres for testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT COUNT(Pg_terminate_backend(procpid)) | |
FROM pg_stat_activity | |
WHERE datname = '#{db_config[:database]}' | |
AND usename NOT IN (SELECT usename | |
FROM pg_user | |
WHERE usesuper); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment