X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id B7C0530E962 for ; Thu, 12 Jun 2003 17:25:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 14739-03 for ; Thu, 12 Jun 2003 14:25:15 -0300 (ADT) Received: from yapok.nexcerpt.com (mail.nexcerpt.com [64.147.202.2]) by svr1.postgresql.org (Postfix) with ESMTP id BE3EA30E932 for ; Thu, 12 Jun 2003 14:25:14 -0300 (ADT) Received: from takin.private.nexcerpt.com (zorro.nexcerpt.com [64.147.202.1]) by yapok.nexcerpt.com (8.11.6/8.11.6) with ESMTP id h5CHPD732483; Thu, 12 Jun 2003 13:25:13 -0400 Subject: Re: Still confused about VACUUM vs. VACUUM FULL From: Jeff Boes To: Tom Lane Cc: pgsql-admin@postgresql.org In-Reply-To: <18292.1055438167@sss.pgh.pa.us> References: <1055434723.27087.23.camel@takin.private.nexcerpt.com> <16631.1055436156@sss.pgh.pa.us> <1055436783.27087.38.camel@takin.private.nexcerpt.com> <18292.1055438167@sss.pgh.pa.us> Content-Type: text/plain Organization: Nexcerpt, Inc. Message-Id: <1055438712.27084.44.camel@takin.private.nexcerpt.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 12 Jun 2003 13:25:13 -0400 Content-Transfer-Encoding: 7bit X-Archive-Number: 200306/132 X-Sequence-Number: 9123 On Thu, 2003-06-12 at 13:16, Tom Lane wrote: > > We're also ANALYZE-ing the largest 12-18 tables on a cycle: every twenty > > minutes, a daemon wakes up and ANALYZEs until they're all done or two > > minutes has elapsed, whichever comes first. > > That sounds a tad excessive; are the statistics really changing that > fast? Well, I have some convincing evidence on this. One table at the center of some of our biggest, hairiest queries uses an index on a timestamp. Generally, the queries run looking back about 24 hours. We are inserting 40,000 rows a day (and deleting the same number, but the deletes happen all at once, and the inserts happen during nearly every part of the clock). I've done explain select * from foo where the_time < ; and found that I could slice it down to a one-minute interval or so: before 11:42 AM, and the optimizer uses a sequential scan; after, and it uses the index. And of course it stays at that point, even if another 10,000 rows get inserted with current timestamps, until it's ANALYZEd again. So two or three ANALYZEs per hour is not excessive, if it will keep the index usable under the "right" circumstances. -- Jeff Boes vox 269.226.9550 ext 24 Database Engineer fax 269.349.9076 Nexcerpt, Inc. http://www.nexcerpt.com ...Nexcerpt... Extend your Expertise