Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 956D79FB3D4 for ; Fri, 20 Jul 2007 13:53:14 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 18654-01 for ; Fri, 20 Jul 2007 13:53:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from h07.llord.com (unknown [195.140.142.194]) by postgresql.org (Postfix) with ESMTP id 672859FB213 for ; Fri, 20 Jul 2007 13:53:11 -0300 (ADT) Received: from par69-8-88-161-102-87.fbx.proxad.net ([88.161.102.87] helo=apollo13) by h07.llord.com with esmtpa (Exim 4.66) (envelope-from ) id 1IBviv-0007mz-9b; Fri, 20 Jul 2007 18:53:01 +0200 Date: Fri, 20 Jul 2007 18:55:02 +0200 To: "Dan Harris" , "PostgreSQL Performance" Subject: Re: Simple query showing 270 hours of CPU time From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 References: <46A0D836.5090806@drivefaster.net> Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: <46A0D836.5090806@drivefaster.net> User-Agent: Opera Mail/9.21 (Linux) X-PopBeforeSMTPSenders: junk@peufeu.com, lists@peufeu.com, peufeu@peufeu.com, pfcaillaud@peufeu.com X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - h07.llord.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - peufeu.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.816 tagged_above=0 required=5 tests=AWL=0.384, BAYES_20=-0.74, RCVD_IN_NJABL_SPAM=2.072, RDNS_NONE=0.1 X-Spam-Level: * X-Archive-Number: 200707/261 X-Sequence-Number: 25945 > Today, I looked at 'top' on my PG server and saw a pid that reported 270 > hours of CPU time. Considering this is a very simple query, I was > surprised to say the least. I was about to just kill the pid, but I > figured I'd try and see exactly what it was stuck doing for so long. If you are using connection pooling, or if your client keeps the connections for a long time, this backend could be very old... With PHP's persistent connections, for instance, backends restart when you restart the webserver, which isn't usually very often.