Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 443EC9FB260; Thu, 11 Jan 2007 16:41:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 45882-05; Thu, 11 Jan 2007 16:41:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail01.enterprisedb.com (mail01.enterprisedb.com [63.246.7.168]) by postgresql.org (Postfix) with ESMTP id A3BA39FA16B; Thu, 11 Jan 2007 16:41:25 -0400 (AST) thread-index: Acc1wOBLyVMDg0FgRl2qq+kJMieheg== Received: from [192.168.0.22] ([84.12.155.249]) by mail01.enterprisedb.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 11 Jan 2007 15:41:31 -0500 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2757 Content-Class: urn:content-classes:message Importance: normal Subject: Re: unusual performance for vac following 8.2 upgrade From: "Simon Riggs" To: "Tom Lane" Cc: "Kim" , , In-Reply-To: <28949.1168544710@sss.pgh.pa.us> References: <45A671CD.1050706@myemma.com> <27939.1168539652@sss.pgh.pa.us> <45A68C74.4080405@myemma.com> <28949.1168544710@sss.pgh.pa.us> Content-Type: text/plain; charset="iso-8859-1" Date: Thu, 11 Jan 2007 20:40:06 +0000 Message-ID: <1168548006.3951.564.camel@silverbirch.site> MIME-Version: 1.0 X-Mailer: Evolution 2.6.0 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 11 Jan 2007 20:41:31.0421 (UTC) FILETIME=[E02A4CD0:01C735C0] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/184 X-Sequence-Number: 22785 On Thu, 2007-01-11 at 14:45 -0500, Tom Lane wrote: > Kim writes: > > We were running on 8.1.1 previous to upgrading to 8.2, and yes, we > > definitely have a heafty pg_class. The inheritance model is heavily used > > in our schema (the results of the group by you wanted to see are down > > below). However, no significant problems were seen with vacs while we > > were on 8.1. > > Odd, because the 8.1 code looks about the same, and it is perfectly > obvious in hindsight that its runtime is about O(N^2) in the number of > relations :-(. At least that'd be the case if the stats collector > output were fully populated. Did you have either stats_block_level or > stats_row_level turned on in 8.1? If not, maybe the reason for the > change is that in 8.2, that table *will* be pretty fully populated, > because now it's got a last-vacuum-time entry that gets made even if the > stats are otherwise turned off. Perhaps making that non-disablable > wasn't such a hot idea :-(. > > What I think we need to do about this is > > (1) fix pgstat_vacuum_tabstats to have non-O(N^2) behavior; I'm thinking > of using a hash table for the OIDs instead of a linear list. Should be > a pretty small change; I'll work on it today. > > (2) Reconsider whether last-vacuum-time should be sent to the collector > unconditionally. > > Comments from hackers? It's not clear to me how this fix will alter the INSERT issue Kim mentions. Are those issues connected? Or are you thinking that handling stats in a tight loop is slowing down other aspects of the system? -- Simon Riggs EnterpriseDB http://www.enterprisedb.com