X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 515BF9FB365 for ; Thu, 13 Jul 2006 22:31:25 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 98778-05 for ; Thu, 13 Jul 2006 22:31:18 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-3.paradise.net.nz (bm-3a.paradise.net.nz [203.96.152.182]) by postgresql.org (Postfix) with ESMTP id 95A649FB317 for ; Thu, 13 Jul 2006 22:31:18 -0300 (ADT) Received: from smtp-2.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-3.paradise.net.nz (Paradise.net.nz) with ESMTP id <0J2D00010DK39V@linda-3.paradise.net.nz> for pgsql-performance@postgresql.org; Fri, 14 Jul 2006 13:31:15 +1200 (NZST) Received: from [192.168.1.11] (218-101-29-75.dsl.clear.net.nz [218.101.29.75]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 90B093B1652; Fri, 14 Jul 2006 13:31:14 +1200 (NZST) Date: Fri, 14 Jul 2006 13:30:39 +1200 From: Mark Kirkwood Subject: Re: Kill a session In-reply-to: <44B51896.1000808@modgraph-usa.com> To: "Craig A. James" Cc: Magnus Hagander , pgsql-performance@postgresql.org Message-id: <44B6F3BF.1000602@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit User-Agent: Thunderbird 1.5.0.4 (X11/20060704) References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> <44B51896.1000808@modgraph-usa.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/137 X-Sequence-Number: 19997 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