Re: Still confused about VACUUM vs. VACUUM FULL

From: Jeff Boes <jboes(at)nexcerpt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Still confused about VACUUM vs. VACUUM FULL
Date: 2003-06-12 17:25:13
Message-ID: 1055438712.27084.44.camel@takin.private.nexcerpt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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 < <some-timestamp>;

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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2003-06-12 18:03:11 Re: Still confused about VACUUM vs. VACUUM FULL
Previous Message Tom Lane 2003-06-12 17:16:07 Re: Still confused about VACUUM vs. VACUUM FULL