Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3nCe-0006PI-6r for pgsql-performance@arkaria.postgresql.org; Fri, 08 Feb 2013 12:37:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U3nCc-0002kb-U6 for pgsql-performance@arkaria.postgresql.org; Fri, 08 Feb 2013 12:37:14 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3nCb-0002in-QR for pgsql-performance@postgresql.org; Fri, 08 Feb 2013 12:37:13 +0000 Received: from cal3-mh484-a.smtproutes.com ([208.70.89.247]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3nCW-0000AF-9u for pgsql-performance@postgresql.org; Fri, 08 Feb 2013 12:37:11 +0000 X-Katharion-ID: 1360327006.94434.cal3-mh484 Received: from JUPITER.northplains.com ([66.207.197.2]) by cal3-mh484.smtproutes.com [(208.70.89.158)] with ESMTP via TCP; 08 Feb 2013 04:36:46 -0800 Received: from [172.16.15.120] (217.150.114.243) by JUPITER.northplains.com (172.16.2.14) with Microsoft SMTP Server (TLS) id 14.1.421.2; Fri, 8 Feb 2013 07:36:45 -0500 Message-ID: <5114F15B.8060700@northplains.com> Date: Fri, 8 Feb 2013 12:36:43 +0000 From: Karolis Pocius User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: Subject: Slow query even with aggressive auto analyze Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [217.150.114.243] X-Pg-Spam-Score: -1.9 (-) 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 This query http://pgsql.privatepaste.com/359bed8e9e gets executed every 500 ms and normally completes really quickly http://explain.depesz.com/s/poVQ, but the more job_batches table (http://pgsql.privatepaste.com/eaf6d63fd2) gets used, the slower this query gets, to the point where it takes minutes to execute http://explain.depesz.com/s/rDJ. Analyzing job_batches table resolves the issue immediately. This table gets about a thousand new records an hour that are also updated three times as the status changes. No deletion is occurring. I've tried changing autovacuum_analyze_scale_factor as well as setting job_batches table to auto analyze every 500 changes (by setting scale factor to 0 and threshold to 500), but I still keep running into that issue, sometimes minutes after the table was analyzed. I checked pg_locks to see if anything had granted=false, but that doesn't seem to be the case. This issue is occurring on two separate instances 9.0.4 and 9.1.4 - both have nearly identical settings, just run on a different hardware. Config changes http://pgsql.privatepaste.com/8acfb9d136 Any ideas what is going wrong here? -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance