Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VBb0F-0004El-Tg for pgsql-performance@arkaria.postgresql.org; Tue, 20 Aug 2013 01:45:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VBb0F-0002sD-7x for pgsql-performance@arkaria.postgresql.org; Tue, 20 Aug 2013 01:44:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VBb0C-0002s3-VL for pgsql-performance@postgresql.org; Tue, 20 Aug 2013 01:44:57 +0000 Received: from mail-pd0-x231.google.com ([2607:f8b0:400e:c02::231]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VBb04-0002Ye-E4 for pgsql-performance@postgresql.org; Tue, 20 Aug 2013 01:44:56 +0000 Received: by mail-pd0-f177.google.com with SMTP id y10so5911823pdj.8 for ; Mon, 19 Aug 2013 18:44:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=Uqnt4M/W1Dj98t2PnUtcC+jmkrzWlm8gIcRWsb2SnF8=; b=tGmb0a0Mm1LPOyzEaJNBhqFf/0r4emTbm2WAifohvwT+ECeOI3z5npQDsPU1Tqb8Z/ jvKtrHNnxl2u3FqwOd0WUWSHlLceA25A3DE8qoWIfln0K+FOmf3wHatFadt61gc/ijxK uwNgyZEMDYHgFnapz6CyyztTJhNe49YD/Pyudhy4P1onQf7sUDFszPt9qz7bu/nGWNYc bnI7ITdfcJS00+hrMlYichrBtsEx08Fzja7cXqIPq0P7t1QKxx7dGN2Sb05/tH+o8cZY SIRSb6pzHbeamF/uWdenHun5WZJ9wZGu94fH1QdWwWZoxwx1/LWb2R6/lRA0maK5M4nb 0LFA== X-Received: by 10.67.23.71 with SMTP id hy7mr781095pad.99.1376963085547; Mon, 19 Aug 2013 18:44:45 -0700 (PDT) Received: from [192.168.1.6] ([116.226.80.181]) by mx.google.com with ESMTPSA id ai6sm376799pad.15.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 18:44:44 -0700 (PDT) Message-ID: <5212CA07.6020509@gmail.com> Date: Tue, 20 Aug 2013 09:44:39 +0800 From: Rural Hunter User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: How to investiage slow insert problem Content-Type: text/plain; charset=GB18030; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Hi, I'm on 9.2.4 with Ubuntu server. There are usually hundereds of connections doing the same insert with different data from different networks every minute, through pgbouncer in the same network of the database server. The database has been running for about one year without problem. Yesterday I got a problem that the connection count limit of the database server is reached. I checked the connections and found that there are many inserts hanging there. I checked the load(cpu,memory,io) of the db server but seems everything is fine. I also checked pg log and I only found there are one "incomplete message from client" error message every several minute. The I recycled pgbouncer and kept monitoring the connections. I found the majority of the inserts finish quickly but every minute there are several inserts left and seems hanging there . So after a while, the connection limit is reached again. Besides those inserts, there are no other long run queries and auto vacuums. I also checked the locks of the inserts and found they were all granted. The insert statement itself is very simple and it only inserts one row but there are some triggers involved. They might impact the performance but I have never experience any since the majority of the inserts are fine. The problem persisted about 1-2 hours. I didn't do anything except recycling pgbouncer a few times. After that period, everything goes back to normal. It's has been 24 hours and it didn't happen again. From the error message in pg log, I supect it might be the network problem from some clients. Could anyone point out if there are other possible causes? I'm also wondering what those inserts are doing actually when they are hanging there, such as if they are in the trigger or not. Anything I can get similar with the connection snapshots in db2? -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance