User Backend Sessions - Mailing list pgsql-general

From Carl Olivier
Subject User Backend Sessions
Date
Msg-id BCEKIKAMLDKFEKBNELFKKEMMCGAA.carl@zero-one.co.za
Whole thread Raw
Responses Re: User Backend Sessions
List pgsql-general
Greetings.
 
OK, I am having a problem, and it is driving me mad!
 
I want to kill off active sessions for a specific database.
 
Now, I have installed PSQL with PL/PERL support and have created a function that allows PSQL to run shell commands.
 
So, from here I can use Sql to get a list of the procpids for backends active for a specific database.
 
now, kill -9 is obviously NOT the best idea to use (i.e. to manually and brute force-like kill the postmaster processes for the backends identified).
 
What other methods are there for me to use?
 
After the backends have been killed, I wish to call the DROP DATABASE dbname command via SQL - which does not work unless no sessions are active for the DB.
 
Can anyone assist me here?  Is there a "clean" way to kill of the connections, even if I need to wait for them to finish their tasks then shut down, so that I can safely call DROP DATABASE?!
 
Please help!
 
Thanks in advance,
 
Carl
 
 

pgsql-general by date:

Previous
From: "erwan ancel"
Date:
Subject: odbc api
Next
From: "shreedhar"
Date:
Subject: Re: Why are queries with subselects so slow?