Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 5165C9FB24B for ; Wed, 10 Jan 2007 21:27:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 79276-08 for ; Wed, 10 Jan 2007 21:27:15 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 574AD9FB24A for ; Wed, 10 Jan 2007 21:27:15 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id C790456423; Wed, 10 Jan 2007 19:27:12 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Wed, 10 Jan 2007 19:27:10 -0600 Date: Wed, 10 Jan 2007 19:27:09 -0600 From: "Jim C. Nasby" To: Jeremy Haile Cc: pgsql-performance@postgresql.org Subject: Re: High inserts, bulk deletes - autovacuum vs scheduled vacuum Message-ID: <20070111012709.GG12217@nasby.net> References: <1168363601.5177.1168380907@webmail.messagingengine.com> <20070110203556.GX12217@nasby.net> <1168461780.9408.1168619515@webmail.messagingengine.com> <20070110212125.GZ12217@nasby.net> <1168465722.17889.1168630713@webmail.messagingengine.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1168465722.17889.1168630713@webmail.messagingengine.com> X-Operating-System: FreeBSD 6.1-RELEASE-p10 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.13 (2006-08-11) X-Hashcash: 1:20:070111:jhaile@fastmail.fm::jRqNQHpbu4Z7zrBP:0000000000000000000 00000000000000000000000028JS X-Hashcash: 1:20:070111:pgsql-performance@postgresql.org::3s18vn4a+hJtU/Mt:00000 0000000000000000000000003Qcl X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/163 X-Sequence-Number: 22764 On Wed, Jan 10, 2007 at 04:48:42PM -0500, Jeremy Haile wrote: > > BTW, that's the default values for analyze... the defaults for vacuum > > are 2x that. > > Yeah - I was actually more concerned that tables would need to be > analyzed more often than I was about vacuuming too often, so I used > analyze as the example. Since my app is inserting constantly throughout > the day and querying for "recent" data - I want to make sure the query > planner realizes that there are lots of rows with new timestamps on > them. In other words, if I run a query "select * from mytable where > timestamp > '9:00am'" - I want to make sure it hasn't been a day since > the table was analyzed, so the planner thinks there are zero rows > greater than 9:00am today. Well, analyze is pretty cheap. At most it'll read only 30,000 pages, which shouldn't take terribly long on a decent system. So you can be a lot more aggressive with it. > > What's more important > > is to make sure critical tables (such as queue tables) are getting > > vacuumed frequently so that they stay small. > > Is the best way to do that usually to lower the scale factors? Is it > ever a good approach to lower the scale factor to zero and just set the > thresholds to a pure number of rows? (when setting it for a specific > table) The problem is what happens if autovac goes off and starts vacuuming some large table? While that's going on your queue table is sitting there bloating. If you have a separate cronjob to handle the queue table, it'll stay small, especially in 8.2. -- Jim Nasby jim@nasby.net EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)