Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id D1ECB2E00A2 for ; Sat, 19 Apr 2008 14:04:11 -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 93414-01 for ; Sat, 19 Apr 2008 14:04:08 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.181]) by developer.postgresql.org (Postfix) with ESMTP id 513F12E0080 for ; Sat, 19 Apr 2008 14:04:08 -0300 (ADT) Received: by wa-out-1112.google.com with SMTP id n7so1688161wag.5 for ; Sat, 19 Apr 2008 10:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=0g8acVDHpNvAhJ+wznwYSg/pZZV8hrP4lZ2sVSWoG+g=; b=ii49CrbMxel3sO/YfI1kdubLa9jtFAAJcTC8x1dskteZ5VSjdFW9HF3jzxR9IGw//FqOC3IvKdomkeIhPAI0oLHFJD7bL0CX16JRNYpv+mq2lqxmH30rl+jwIoWInyPHiSfDh3DEIdfF9+hRbH2Wx1DJTouWH2oh5kBir+33Qbg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=H30q3EZGnOPwqZxoDxC7+MZilgCMAjw9mNhvfx30wciEqgza+f21jaxEGiyMWfMx6N8vvIK+F841B2fbvA7D4fr2fslkuOTl6xqQizgwCmXa8StmRHqTa7TS51Ksd4xuQoQ3XiwdScADJFId0ICjF4yyZKnFiLmhSzFwfLJbWzI= Received: by 10.114.81.1 with SMTP id e1mr1073086wab.11.1208624646930; Sat, 19 Apr 2008 10:04:06 -0700 (PDT) Received: by 10.114.137.7 with HTTP; Sat, 19 Apr 2008 10:04:06 -0700 (PDT) Message-ID: Date: Sat, 19 Apr 2008 11:04:06 -0600 From: "Scott Marlowe" To: "Thomas Spreng" Subject: Re: Oddly slow queries Cc: "Chris Browne" , pgsql-performance@postgresql.org In-Reply-To: <20B852C4-2ACA-445F-9289-558B6C86BAB4@socket.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3D7728ED-3D36-47E6-9266-351073ED4E11@socket.ch> <60y77du7qs.fsf@dba2.int.libertyrms.com> <20B852C4-2ACA-445F-9289-558B6C86BAB4@socket.ch> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/287 X-Sequence-Number: 29780 On Wed, Apr 16, 2008 at 3:48 PM, Thomas Spreng wrote: > > On 16.04.2008, at 17:42, Chris Browne wrote: > > > spreng@socket.ch (Thomas Spreng) writes: > > > > > On 16.04.2008, at 01:24, PFC wrote: > > > > > > > > > > > > > > > > The queries in question (select's) occasionally take up to 5 mins > > > > > even 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 > > > > > still in a testing phase. I tried to hunt down the problem by > > > > > playing around with resource usage cfg options but it didn't really > > > > > made a difference. > > > > > > > > > > > > > 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. > > > > > > > No, that will certainly NOT just affect write performance; if the > > postmaster is busy writing out checkpoints, that will block SELECT > > queries that are accessing whatever is being checkpointed. > > > > What I meant is if there are no INSERT's or UPDATE's going on it shouldn't > affect SELECT queries, or am I wrong? But checkpoints only occur every 10 seconds because of a high insert / update rate. So, there ARE inserts and updates going on, and a lot of them, and they are blocking your selects when checkpoint hits. While adjusting your background writer might be called for, and might provide you with some relief, you REALLY need to find out what's pushing so much data into your db at once that it's causing a checkpoint storm.