Re: How to force disconnections from a Perl script?

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Kynn Jones <kynnjo(at)gmail(dot)com>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to force disconnections from a Perl script?
Date: 2007-02-19 16:52:54
Message-ID: 1171903974.3101.300.camel@coppola.muc.ecircle.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Why irrecoverably? If the command fails, you just wait and try it
> again.

> You could use the pg_stat tables to work out who is connected and use
> pg_cancel_backend() to kill them. You could "kill -INT" them yourself.
> You could change the pg_hba.conf to forbid logging in and then bouncing
> the server.

I was going to suggest the same things you did, but then I thought
better... the OP is running the thing at night from a client box, not on
the DB, so restart and process listing is probably off limits...

There's 0 chance somebody will close at midnight it's open connection
forgotten when he left office, so wait and retry would not do any good
;-)

And pg_stat will only show you running queries, not the idle
connections.

If you only could list all the connection's pids in a client you could
loop and kill them all. Of course the loop would kill itself too if not
careful enough ;-)

Cheers,
Csaba.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vivek Khera 2007-02-19 17:02:30 Re: open source - content management system - that uses PostGreSQL
Previous Message Alvaro Herrera 2007-02-19 16:35:55 Re: QNX, RTOS y Postgres