Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 67BC31C0B199 for ; Fri, 20 Jul 2012 18:54:01 -0300 (ADT) Received: from mail.anatec.com ([87.84.168.242]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1SsL95-0006IQ-Ab for pgsql-performance@postgresql.org; Fri, 20 Jul 2012 21:54:00 +0000 Received: from [192.168.10.57] ([192.168.10.57]) by mail.anatec.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 20 Jul 2012 22:53:46 +0100 Message-ID: <5009D36A.10506@anatec.com> Date: Fri, 20 Jul 2012 22:53:46 +0100 From: Ioannis Anagnostopoulos User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Rosser Schwarz CC: Claudio Freire , pgsql-performance@postgresql.org Subject: Re: A very long running query.... References: <5007FC82.9070007@anatec.com> <5009CB5A.7070801@anatec.com> <5009CD43.8000300@anatec.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 20 Jul 2012 21:53:46.0494 (UTC) FILETIME=[2343B1E0:01CD66C2] X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/247 X-Sequence-Number: 47428 On 20/07/2012 22:33, Rosser Schwarz wrote: > On Fri, Jul 20, 2012 at 2:27 PM, Ioannis Anagnostopoulos > wrote: >> On 20/07/2012 22:23, Claudio Freire wrote: >>> Misestimated row counts... did you try running an analyze, or upping >>> statistic targets? >> I have run analyse every so often. I think the problem is that as I get 16K >> new rows every minutes, the "stats" are always out... Possible? > It may not help much with any skew in your data that results from > divergent data appearing, but you can update the statistics targets > for those columns and analyze again, and the planner should have much > better information about the distributions of their data. The max > stats target is 10000, but the default is 100. Increasing it even > just to 500 or 1000 should help the planner significantly. > > rls > I suppose that this is some kind of postgres.conf tweak?