Re: Kill a session

From: "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com>
To: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
Cc: Magnus Hagander <mha(at)sollentuna(dot)net>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Kill a session
Date: 2006-07-14 02:17:14
Message-ID: 44B6FEAA.7070708@modgraph-usa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Thanks for your reply, Mark:
>> 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?
>
> ... 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

This answers my question. I've finally got a statement in concrete terms, Postgres has no way to kill a backend process via an SQL statement. "If Mark had to resort to this, then there is no other way."

> 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!

Thanks, but I've already implemented my own, which is essentially identical in concept to yours, but simpler in the sense of being even less safe than yours -- I just let anyone send the signal, since I have no users other than my own app. I'll keep my version since it's embedded in my own plug-in. That way I won't have to keep remembering to modify the Postgres code when I upgrade. I like to keep Postgres "stock".

Craig

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Craig A. James 2006-07-14 02:23:19 Re: Kill a session
Previous Message Mark Kirkwood 2006-07-14 01:30:39 Re: Kill a session