Postgresql – Drop connections script

Select another database in pgadmin and execute this script to drop all connected users.

Script

-- view active connections
SELECT * FROM pg_stat_activity WHERE datname='DBNAME';
-- drop active connections
SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname='DBNAME';

admin

Chris Tran is a Software Business Manager from Brisbane, Australia. When he's not enjoying time with his family, he works with some very talented people at KoBold Group Pty Ltd.

More Posts

Follow Me:
TwitterFacebookLinkedInGoogle PlusFlickrYouTube

Comments