Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 8B18D9FBDB4 for ; Wed, 25 Apr 2007 11:57:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 09747-03-5 for ; Wed, 25 Apr 2007 11:57:45 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) by postgresql.org (Postfix) with ESMTP id 653389FBDA6 for ; Wed, 25 Apr 2007 11:57:45 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id k3so344702ugf for ; Wed, 25 Apr 2007 07:57:43 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=CyKWU+3Ov/AxkZQT0+sIWLUJLdzN56+/MjU7ozQn9QupMeSkLJIj+Y3QLyNnmNN8meXJ9BoOQ1IE3UVRG8+PvPMMClLY+5yKcKUIT8TwH7rx51nU2QV2W3qxiEy7EBVlqoa+5mOIwNp/8Yo5U955VW/QPGtQcWTd8+p1MEwzWvE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=Pt4yGJ9mu/H9r9G9yAIT8Q9v1+y4vuSYKNGJWiE/y/Pn81drEvISb0UT+fWR8AgTw7YZXudmuDHihCTSPGiLRyJe2GDbpxZOmLPWtdInR7eYMGIR4p4QlnJn7wwWszdH4EzVad3BuEQUWngAhsjSoDswlEfjKiUaHTF8rSTQmWU= Received: by 10.82.173.19 with SMTP id v19mr1215657bue.1177513063447; Wed, 25 Apr 2007 07:57:43 -0700 (PDT) Received: from ?192.168.1.34? ( [82.20.23.216]) by mx.google.com with ESMTP id b36sm17267ika.2007.04.25.07.57.19; Wed, 25 Apr 2007 07:57:37 -0700 (PDT) Message-ID: <462F6C32.5010604@enterprisedb.com> Date: Wed, 25 Apr 2007 15:56:50 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.10 (X11/20070329) MIME-Version: 1.0 To: Mageshwaran CC: pgsql-general@postgresql.org, pgsql-admin@postgresql.org, Postgres Subject: Re: [HACKERS] Kill a Long Running Query References: <462F66C1.4030303@sifycorp.com> In-Reply-To: <462F66C1.4030303@sifycorp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/230 X-Sequence-Number: 25294 Please don't cross-post to multiple mailing lists. And pgsql-hackers is not the correct list for basic usage questions. And long end-of-mail disclaimers are not generally appreciated. Mageshwaran wrote: > Any body tell me how to kill a long running query in postgresql, is > there any statement to kill a query, See the user manual on administration functions, pg_cancel_backend in particular: http://www.postgresql.org/docs/8.2/interactive/functions-admin.html Basically you issue a "SELECT * FROM pg_stat_activity", or plain ps to find out the pid of the backend executing the long running query, and then use pg_cancel_backend (or kill -INT) to cancel it. > and also tell me how to log slow queries to a log file. Using the log_min_duration_statement configuration variable. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com