User Backend Sessions

From: "Carl Olivier" <carl(at)zero-one(dot)co(dot)za>
To: <pgsql-general(at)postgresql(dot)org>
Subject: User Backend Sessions
Date: 2003-03-07 11:17:46
Message-ID: BCEKIKAMLDKFEKBNELFKKEMMCGAA.carl@zero-one.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message shreedhar 2003-03-07 11:27:24 Re: Why are queries with subselects so slow?
Previous Message erwan ancel 2003-03-07 10:47:59 odbc api