X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 721C29DC846 for ; Thu, 23 Feb 2006 19:43:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94734-03 for ; Thu, 23 Feb 2006 19:43:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 265509DC83C for ; Thu, 23 Feb 2006 19:43:40 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 352D756428; Thu, 23 Feb 2006 17:44:14 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Thu, 23 Feb 2006 17:44:12 -0600 Date: Thu, 23 Feb 2006 17:44:12 -0600 From: "Jim C. Nasby" To: Robin Iddon Cc: Tom Lane , pgsql-admin@postgresql.org Subject: Re: 8.0.3 pg_autovacuum doesn't clear out stats table? Message-ID: <20060223234412.GM2068@pervasive.com> References: <43FD7312.5080701@edesix.com> <43FDF046.2050609@zeut.net> <43FDFF9A.90603@edesix.com> <43FE0723.3070608@edesix.com> <26139.1140730764@sss.pgh.pa.us> <43FE467E.9090204@edesix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43FE467E.9090204@edesix.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060223:robin@edesix.com::saYvTT3aERk6uf8K:07crs X-Hashcash: 1:20:060223:tgl@sss.pgh.pa.us::luBhOm94oAX1lUAn:00000000000000000000 00000000000000000000000042vU X-Hashcash: 1:20:060223:pgsql-admin@postgresql.org::F7IqwXd4DLcDBqVZ:00000000000 0000000000000000000000009QLw X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.104 required=5 tests=[AWL=0.104] X-Spam-Score: 0.104 X-Spam-Level: X-Archive-Number: 200602/301 X-Sequence-Number: 20722 On Thu, Feb 23, 2006 at 11:34:22PM +0000, Robin Iddon wrote: > From that I see that the pg_statistics table is never inserted/deleted > only updated (ins/del counts are 0), and in principle simply analyzing > doesn't increase the tuple count. Sure it does. An update in PostgreSQL is essentially identical to a DELETE followed by an INSERT, due to MVCC. > I wonder if Matt's suggestion on the vacuum scale is not in fact the > real issue here. Because my scale is set to 2 (the default) but the > number of inserts is always zero (unless we create new tables/indexes, I > think the number of active stats stays the same, no?) and the number of > updates is at most equal to the number of tuples, we can never get > enough changes to trigger a vacuum (which would require 2x the number of > updates). Now any removable rows won't ever get removed. Sure it well, unless pg_autovacuum can't stay running long enough. > In fact I just noticed that the number of stats tuples just climbed from > 1236 to 2634. The ins/del counts are still zero. I ran analyze and the > update counter went up only by 1232. For pg_autovacuum to vacuum this > table I need (2*2634)+1000 = 6268 updates, which is never going to happen. Uh, just run analyze 6 times; that should be enough to cause autovacuum to kick in. > So I'm going to run with a fractional value of scale for a while and see > if it makes things any better. Definately a good idea in any case. You might also consider going to 8.1.3; you'd get built-in autovac which means one less thing to manage, plus it's default settings are a lot saner (though still too high IMHO). -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461