Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 9E8A31648186 for ; Fri, 30 Mar 2012 22:21:46 -0300 (ADT) Received: from [2001:1528:137::f1] (helo=mail.gransy.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SDn0j-0005YK-Dc for pgsql-performance@postgresql.org; Sat, 31 Mar 2012 01:21:45 +0000 Received: from antispam.gransy.com (antispam.gransy.com [77.78.104.124]) by mail.gransy.com (Postfix) with ESMTP id 0D2DE508652 for ; Sat, 31 Mar 2012 03:21:33 +0200 (CEST) Received: from mail.gransy.com ([82.208.29.194]) by antispam.gransy.com (antispam.gransy.com [77.78.104.124]) (amavisd-new, port 10024) with ESMTP id JegovrZGF5IL for ; Sat, 31 Mar 2012 03:21:32 +0200 (CEST) Received: by mail.gransy.com (Postfix, from userid 5000) id EE69B508675; Sat, 31 Mar 2012 03:21:32 +0200 (CEST) Received: from [192.168.1.237] (ip-78-45-133-255.net.upcbroadband.cz [78.45.133.255]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.gransy.com (Postfix) with ESMTPSA id C8C69508652 for ; Sat, 31 Mar 2012 03:21:32 +0200 (CEST) Message-ID: <4F765C1D.7010205@fuzzy.cz> Date: Sat, 31 Mar 2012 03:21:33 +0200 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120312 Thunderbird/11.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: database slowdown while a lot of inserts occur References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:1528:137::f1 (failed) X-Pg-Spam-Score: -1.1 (-) X-Archive-Number: 201203/193 X-Sequence-Number: 46643 Hi, On 29.3.2012 19:59, Campbell, Lance wrote: > PostgreSQL 9.0.x > > We have around ten different applications that use the same database. > When one particular application is active it does an enormous number of > inserts. Each insert is very small. During this time the database > seems to slow down in general. The application in question is inserting > into a particular table that is not used by the other applications. Can you provide more info? Show us some vmstat / 'iostat -x' logs so that we can see what kind of bottleneck are you hitting. Provide more details about your system (especially I/O subsystem - what drives, what RAID config etc.) Also, we need more details about the workload. Is each INSERT a separate transaction or are they grouped into transactions fo multiple INSERTs? > 1) What should I do to confirm that the database is the issue and > not the applications? Well, usually the application is the culprit. Some applications are designed so that it's almost certain there was a 'let's poke the database as hard as possible' goal at the beginning. Not sure it's this case, though. Might be a misconfigured database too - what are the basic parameters (shared buffers, ...)? > 2) How can I identify where the bottle neck is occurring if the > issue happens to be with the database? Watching 'iostat -x' or 'top' will usually point you the right direction. Is the CPU fully utilized => you're doing something that needs more CPU time than you have? Is the I/O wait high (say above 50%)? Well, you have issues with I/O bottlenecks (either random or sequential). The less visible bottlenecks are usually related to memory, bus bandwidth etc. Tomas