Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AD9C09F9462 for ; Tue, 9 Oct 2007 16:00:21 -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 49852-09 for ; Tue, 9 Oct 2007 16:00:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from oxford.xeocode.com (unknown [87.127.95.196]) by postgresql.org (Postfix) with ESMTP id 20FA39F9467 for ; Tue, 9 Oct 2007 16:00:11 -0300 (ADT) Received: from localhost.enta.net ([127.0.0.1] helo=oxford.xeocode.com) by oxford.xeocode.com with esmtp (Exim 4.67) (envelope-from ) id 1IfKJL-0007Pk-87; Tue, 09 Oct 2007 20:00:07 +0100 To: "Heikki Linnakangas" Cc: "Campbell\, Lance" , Subject: Re: SQL Monitoring In-Reply-To: <470B994F.1040405@enterprisedb.com> (Heikki Linnakangas's message of "Tue\, 09 Oct 2007 16\:07\:59 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Draft-From: ("nnimap+mail01.enterprisedb.com:INBOX.performance" 2754) References: <470B994F.1040405@enterprisedb.com> From: Gregory Stark Organization: EnterpriseDB Date: Tue, 09 Oct 2007 20:00:06 +0100 Message-ID: <878x6ccdvt.fsf@oxford.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/86 X-Sequence-Number: 27108 "Heikki Linnakangas" writes: > Campbell, Lance wrote: >> I have noticed a slight spike in the amount of CPU usage in the last few >> weeks. I am sure it has to do with a change or two that was made to >> some queries. What is the best way to log the SQL that is being >> executed? > > Take a look at statement_timeout and log_statement configuration variables. I suspect he meant log_min_duration_statement which lets you log only queries which take too long and not statement_timeout which would actually kill your query if it took too long. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com