Re: Function to kill backend

Rod Taylor <rbt@rbt.ca>

From: Rod Taylor <rbt@rbt.ca>
To: Magnus Hagander <mha@sollentuna.net>
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Date: 2004-04-02T22:02:25Z
Lists: pgsql-hackers
On Fri, 2004-04-02 at 16:52, Magnus Hagander wrote:
> Hi!
> 
> When debugging on win32, I've created myself a little function that I
> feel should be added to the "backend proper". While it adds a lot of
> vlaue on win32, I think it adds quite a bit of value on non-win32
> platforms as well...
> 
> The function is pg_kill_backend(<pid>,<signal>). superuser-only, of
> course. Which simply sends a signal to the specified backend -
> querycancel, terminate, etc.

Nice.. My new favourite command is going to be:

SELECT pg_kill_backend(procpid, 'TERM') FROM pg_stat_activity WHERE
current_query LIKE '<IDLE>%';

-- 
Rod Taylor <rbt [at] rbt [dot] ca>

Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
PGP Key: http://www.rbt.ca/signature.asc