Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id 0B2E42E00B4 for ; Tue, 22 Apr 2008 07:24:56 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 55738-03-3 for ; Tue, 22 Apr 2008 07:24:45 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from 27.mail-out.ovh.net (27.mail-out.ovh.net [91.121.30.210]) by developer.postgresql.org (Postfix) with SMTP id CBFCE2E0083 for ; Tue, 22 Apr 2008 07:24:49 -0300 (ADT) Received: (qmail 22262 invoked by uid 503); 22 Apr 2008 12:10:08 -0000 Received: from gw2.ovh.net (HELO mail174.ha.ovh.net) (213.251.189.202) by 27.mail-out.ovh.net with SMTP; 22 Apr 2008 12:10:08 -0000 Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 22 Apr 2008 10:24:48 -0000 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO apollo13.peufeu.com) (88.161.102.87) by ns0.ovh.net with SMTP; 22 Apr 2008 10:24:47 -0000 Date: Tue, 22 Apr 2008 12:29:29 +0200 To: "Thomas Spreng" , "Scott Marlowe" Subject: Re: Oddly slow queries From: PFC Cc: "Chris Browne" , pgsql-performance@postgresql.org Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 References: <3D7728ED-3D36-47E6-9266-351073ED4E11@socket.ch> <60y77du7qs.fsf@dba2.int.libertyrms.com> <20B852C4-2ACA-445F-9289-558B6C86BAB4@socket.ch> <3D0211BE-8936-4705-964F-42E31263D88A@socket.ch> Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: <3D0211BE-8936-4705-964F-42E31263D88A@socket.ch> User-Agent: Opera Mail/9.24 (Linux) X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|H 0.5/N X-Ovh-Tracer-Id: 15393303528339211824 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.897 tagged_above=0 required=5 tests=AWL=0.582, SARE_MILLIONSOF=0.315 X-Spam-Level: X-Archive-Number: 200804/311 X-Sequence-Number: 29804 > that's correct, there are nightly (at least at the moment) processes that > insert around 2-3 mio rows and delete about the same amount. I can see > that > those 'checkpoints are occurring too frequently' messages are only logged > during that timeframe. Perhaps you should increase the quantity of xlog PG is allowed to write between each checkpoint (this is checkpoint_segments). Checkpointing every 10 seconds is going to slow down your inserts also, because of the need to fsync()'ing all those pages, not to mention nuking your IO-bound SELECTs. Increase it till it checkpoints every 5 minutes or something. > I assume that it's normal that so many INSERT's and DELETE's cause the Well, also, do you use batch-processing or plpgsql or issue a huge mass of individual INSERTs via some script ? If you use a script, make sure that each INSERT doesn't have its own transaction (I think you know that since with a few millions of rows it would take forever... unless you can do 10000 commits/s, in which case either you use 8.3 and have activated the "one fsync every N seconds" feature, or your battery backed up cache works, or your disk is lying)... If you use a script and the server is under heavy load you can : BEGIN Process N rows (use multi-values INSERT and DELETE WHERE .. IN (...)), or execute a prepared statement multiple times, or copy to temp table and process with SQL (usually much faster) COMMIT Sleep Wash, rinse, repeat > background writer to choke a little bit. I guess I really need to adjust > the > processes to INSERT and DELETE rows in a slower pace if I want to do > other > queries during the same time. > > cheers, > > tom >