Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id D5BD69FBA10 for ; Wed, 25 Apr 2007 11:49:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 94779-02 for ; Wed, 25 Apr 2007 11:48:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.174]) by postgresql.org (Postfix) with ESMTP id 4F6CE9FBA4B for ; Wed, 25 Apr 2007 11:48:57 -0300 (ADT) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), id 0MKwtQ-1Hgind4AuW-0004lm; Wed, 25 Apr 2007 16:48:54 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1HginZ-0007Yn-00 for pgsql-general@postgresql.org; Wed, 25 Apr 2007 16:48:49 +0200 Date: Wed, 25 Apr 2007 16:48:49 +0200 From: "A. Kretschmer" To: pgsql-general@postgresql.org Subject: Re: Kill a Long Running Query Message-ID: <20070425144849.GH12260@a-kretschmer.de> References: <462F66C1.4030303@sifycorp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <462F66C1.4030303@sifycorp.com> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! User-Agent: Mutt/1.5.9i X-Provags-ID: V01U2FsdGVkX1/qReOxbkZtmbkbFRdVomPZXGz/wRxsMpqePcA aXuxCuzw0uCqtIscz8j6lVAmvly1hM8Q2/bNRJuzYVB3t+S5uo yCDdI3oBWEyuTSJi55adVEUroCuLVpV X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/1048 X-Sequence-Number: 112951 am Wed, dem 25.04.2007, um 20:03:37 +0530 mailte Mageshwaran folgendes: > Hi , > Any body tell me how to kill a long running query in postgresql, is > there any statement to kill a query, and also tell me how to log slow > queries to a log file. pg_cancel_backend(pid int) to kill. You need to know the pid, you can obtain the pid from pg_stat_activity. To log slow querys you can set log_min_duration_statement to a propper value, in ms. All querys with an execution time more than that logged. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net