Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id C78302E0049 for ; Wed, 16 Apr 2008 05:17:19 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 62834-04 for ; Wed, 16 Apr 2008 05:17:12 -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 DD4C22E0046 for ; Wed, 16 Apr 2008 05:17:10 -0300 (ADT) Received: (qmail 18023 invoked by uid 503); 16 Apr 2008 09:58:29 -0000 Received: from gw2.ovh.net (HELO mail174.ha.ovh.net) (213.251.189.202) by 27.mail-out.ovh.net with SMTP; 16 Apr 2008 09:58:29 -0000 Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 16 Apr 2008 08:17:09 -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; 16 Apr 2008 08:17:07 -0000 Date: Wed, 16 Apr 2008 10:21:38 +0200 To: "Thomas Spreng" Subject: Re: Oddly slow queries From: PFC Cc: 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> Content-Transfer-Encoding: Quoted-Printable Message-ID: In-Reply-To: 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: 14827257348862707248 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.799 tagged_above=0 required=5 tests=AWL=0.799 X-Spam-Level: X-Archive-Number: 200804/199 X-Sequence-Number: 29692 On Wed, 16 Apr 2008 06:07:04 +0200, Thomas Spreng wro= te: > > On 16.04.2008, at 01:24, PFC wrote: >> >>> The queries in question (select's) occasionally take up to 5 mins ev= en = >>> if they take ~2-3 sec under "normal" conditions, there are no = >>> sequencial scans done in those queries. There are not many users = >>> connected (around 3, maybe) to this database usually since it's stil= l = >>> in a testing phase. I tried to hunt down the problem by playing arou= nd = >>> with resource usage cfg options but it didn't really made a differen= ce. >> >> Could that be caused by a CHECKPOINT ? > > > actually there are a few log (around 12 per day) entries concerning = > checkpoints: > > LOG: checkpoints are occurring too frequently (10 seconds apart) > HINT: Consider increasing the configuration parameter = > "checkpoint_segments". > > But wouldn't that only affect write performance? The main problems I'm= = > concerned about affect SELECT queries. OK, so if you get 12 of those per day, this means your checkpoint = interval isn't set to 10 seconds... I hope... Those probably correspond to some large update or insert query that com= es = from a cron or archive job ?... or a developer doing tests or filling a= = table... So, if it is checkpointing every 10 seconds it means you have a pretty = = high write load at that time ; and having to checkpoint and flush the = dirty pages makes it worse, so it is possible that your disk(s) choke on= = writes, also killing the selects in the process. -> Set your checkpoint log segments to a much higher value -> Set your checkpoint timeout to a higher value (5 minutes or = something), to be tuned afterwards -> Tune bgwriter settings to taste (this means you need a realistic loa= d, = not a test load) -> Use separate disk(s) for the xlog -> For the love of God, don't keep the RAID5 for production ! (RAID5 + 1 small write =3D N reads + N writes, N=3D3 in your case) Since this is a test server I would suggest RAID1 for the OS and databa= se = files and the third disk for the xlog, if it dies you just recreate the = = DB...