Re: Is regular vacuuming with autovacuum needed?

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Koczan <pjkoczan(at)gmail(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Is regular vacuuming with autovacuum needed?
Date: 2010-08-16 19:51:39
Message-ID: 4C6996CB.9090808@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Tom Lane wrote:
> On versions where autovacuum is on by default, I would certainly
> recommend trying to use only autovacuum. cron-driven vacuum still
> has some uses but they are corner cases.
>

Corner cases implies something a bit more rare than I'd consider the
case here. Consider a server where you know you have a large table that
ends up with 5% dead rows each day. This will cause autovacuum to kick
in to clean up about every 4 days, at the defaults where
autovacuum_vacuum_scale_factor = 0.2.

When it does finally get to that table, it's going to have a fairly
large amount of work to do. If that happens during peak load time on
your server, you may find that a painful shock.

In that situation, it's completely reasonable to manually vacuum that
table each day during a known slow period, late at night for example.
Then it will never get to where it's so bloated that a hefty autovacuum
kicks in at an unpredictable time.

The other alternative here is to just tune autovacuum so it runs really
slowly, so it won't kill responsiveness during any peak period. While
in theory that's the right thing to do, this is much harder to get
working well than what I just described.

--
Greg Smith 2ndQuadrant US Baltimore, MD
PostgreSQL Training, Services and Support
greg(at)2ndQuadrant(dot)com www.2ndQuadrant.us

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2010-08-16 20:01:24 Re: Is regular vacuuming with autovacuum needed?
Previous Message Tom Lane 2010-08-16 18:35:16 Re: Is regular vacuuming with autovacuum needed?