From: Mark Kirkwood <markir@paradise.net.nz>
To: Craig A. James <cjames@modgraph-usa.com>
Cc: Magnus Hagander <mha@sollentuna.net>
Cc: pgsql-performance@postgresql.org
Subject: Re: Kill a session
Date: Fri, 14 Jul 2006 13:30:39 +1200
Message-ID: <44B6F3BF.1000602@paradise.net.nz> (raw)
In-Reply-To: <44B51896.1000808@modgraph-usa.com>
References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se>
<44B51896.1000808@modgraph-usa.com>
Craig A. James wrote:
>
>
> I'm back to my original question: How do you kill a runaway query
> without bringing down the whole database? Is there really no answer to
> this?
>
As others have mentioned, pg_cancel_backend(pid) will stop query
execution by backend process id 'pid'.
While this is often enough, if you actually want to disconnect a backend
process then there is nothing to let you do this remotely. I recently
did a patch for Bizgres that just implements the
pg_terminate_backend(pid) function (currently #ifdef'ed out of the
codebase) as a contrib so it can be easily installed. See
http://pgfoundry.org/pipermail/bizgres-general/2006-May/000484.html
If you want to try it out, please read the README (it discusses possible
dangers associated with sending SIGTERM to backends). And I would
certainly be interested in hearing what level of success (or otherwise)
you have with it!
Best wishes
Mark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: markir@paradise.net.nz, cjames@modgraph-usa.com, mha@sollentuna.net
Subject: Re: Kill a session
In-Reply-To: <44B6F3BF.1000602@paradise.net.nz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox