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 7208C9FB400 for ; Wed, 12 Jul 2006 14:05:40 -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 67330-02 for ; Wed, 12 Jul 2006 14:05:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id B63FA9FB3E2 for ; Wed, 12 Jul 2006 14:05:30 -0300 (ADT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1G0i9P-0004l4-4i for pgsql-performance@postgresql.org; Wed, 12 Jul 2006 19:05:28 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1G0i84-00078X-00 for ; Wed, 12 Jul 2006 19:04:04 +0200 Date: Wed, 12 Jul 2006 19:04:04 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Kill a session Message-ID: <20060712170404.GA27392@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> <44B51896.1000808@modgraph-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <44B51896.1000808@modgraph-usa.com> X-Operating-System: Linux 2.6.16trofastxen on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11+cvs20060403 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/108 X-Sequence-Number: 19968 On Wed, Jul 12, 2006 at 08:43:18AM -0700, Craig A. James wrote: >> Then you killed the wrong backend... >> No queries run in postmaster. They all run in postgres backends. The >> postmaster does very little actual work, other than keeping track of >> everybody else. > > It turns out I was confused by this: ps(1) reports a process called > "postgres", but top(1) reports a process called "postmaster", but they both > have the same pid. I guess postmaster replaces its own name in the process > table when it's executing a query, and it's not really the postmaster even > though top(1) calls it postmaster. > > So "kill -15 " is NOT killing the process -- to kill the process, I > have to use signal 9. But if I do that, ALL queries in progress are > aborted. I might as well shut down and restart the database, which is an > unacceptable solution for a web site. I don't follow your logic here. If you do "kill -15 " of the postmaster doing the work, the query should be aborted without taking down the entire cluster. I don't see why you'd need -9 (which is a really bad idea anyhow)... > 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? Kill it with -15. If you're worried about your CGI scripts, use sudo or some sort of client/server solution. /* Steinar */ -- Homepage: http://www.sesse.net/