Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 4ACF716FA503 for ; Mon, 9 Jul 2012 22:25:54 -0300 (ADT) Received: from mail-pb0-f46.google.com ([209.85.160.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SoPD6-0001Ql-Ny for pgsql-performance@postgresql.org; Tue, 10 Jul 2012 01:25:53 +0000 Received: by pbbrp8 with SMTP id rp8so20109945pbb.19 for ; Mon, 09 Jul 2012 18:25:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=Y+ChdFgo+B0jsq+dCUuZDDAGIeHgdYfsLekMIKvk2UM=; b=LJu3XVJXLhWl4kideCtRdMHK0pEC1Hm1+SLMAUMmUolcGb7B/OZv56FoEq2N7U7bMH H32cqWfTQB1AfLbLO6DfDg8B3jXLRh+oSDNhdTguoJoeiFVFfbqD8uyPWWFG9aDrreqO Rj8+vl0IJ6qy+uNOJe6BYCKZDSoWTQ1W4xBuzsqC8FTSH/t6TFdzynLhIuhwMxd3QDU+ HbzNOP9TbrxDuXwOXG5KHHsARRNiDxRoAig1uSHS+vj6IB4PzOZfiI6+nE4kD8R0hlK4 plggAAXYZwUb6qI4cpwuqfZAXT0MAmdjQhgzn+Coeq0oT+G41iVRIg9hr4euGOIYc2Se iBZQ== Received: by 10.66.84.71 with SMTP id w7mr69676522pay.33.1341883539038; Mon, 09 Jul 2012 18:25:39 -0700 (PDT) Received: from ayaki.localdomain ([114.75.203.105]) by mx.google.com with ESMTPS id nj4sm14835467pbc.5.2012.07.09.18.25.35 (version=SSLv3 cipher=OTHER); Mon, 09 Jul 2012 18:25:38 -0700 (PDT) Message-ID: <4FFB848D.7080900@ringerc.id.au> Date: Tue, 10 Jul 2012 09:25:33 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: Yan Chunlu CC: Albe Laurenz , pgsql-performance@postgresql.org Subject: Re: how could select id=xx so slow? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQn2DLxJ7outAQrU5FxGUGIJmITcCjcWjZ2qw26l+S7a0zedd/PGWnV1rBLZjMysToUiKfOu X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/104 X-Sequence-Number: 47285 On 07/09/2012 05:20 PM, Yan Chunlu wrote: > > the value of "log_min_messages" in postgresql.conf is error, I have > changed it to "warning", so far does not received any warning, still > waiting. When trying to track down performance issues, increasing logging to at least `info' would seem to be sensible. I suggest increasing your logging and enabling the auto_explain module so it logs slow queries. If you can afford the substantial performance hit you could enable its analyze mode to get details on why. > > beside I do see some COMMIT which is relatively slow for example: > 60 2012-07-08 00:00:29 CST [19367]: [131-1] LOG: duration: 375.851 > ms statement: COMMIT > 61 2012-07-08 00:00:30 CST [19367]: [132-1] LOG: duration: 327.964 > ms statement: COMMIT That certainly is slow. Again, I suspect checkpoint activity could be at fault. You may need to tune to spread your checkpoints out and use more aggressive bgwriter settings. See the wiki for performance tuning info. > > but only one "BEGIN" in the same one day log file, did that influence > the query time too? Only one BEGIN in the whole day? Or do you mean "only one BEGIN slow enough to trigger slow query logging" ? Do you have a "log_min_duration_statement" directive set in your postgresql.conf ? -- Craig Ringer