Re: Vacuum taking an age

From: Guido Neitzer <lists(at)event-s(dot)net>
To: Brian Modra <epailty(at)googlemail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Vacuum taking an age
Date: 2008-01-04 02:33:21
Message-ID: BF47E794-F83E-4EE0-A087-9877BCEF8608@event-s.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 03.01.2008, at 05:48, Brian Modra wrote:

> I have a pretty "live" table: rows being inserted and updated more
> than once 1 per second, though far, far more inserts than updates.

Not that busy ;-)

> It has not been vacuumed for months.

Not good.

> Now a vacuum on that table takes hours, and I have not let it complete
> because it stays running into our daily busy time... but I've been
> told its necessary because the table is slowing down.
>
> I have begun a cron job which will do a daily analyze, and am thinking
> of a weekly vacuum...
> Please advise on the best way to keep this table maintained, even if
> it means regularly taking the service offline early on Sunday
> morning...

Two things you can consider:

1. Cluster the table with one of the indexes. This will be really
fast, but is not transaction-safe as far as I remember for 8.2.x.

2. Use autovaccum to vacuum / analyze your database all the time. That
will keep the size small and the stats up to date.

cug

--
http://www.event-s.net

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Brian Modra 2008-01-04 04:55:13 Re: Vacuum taking an age
Previous Message Scott Marlowe 2008-01-04 02:31:13 Re: Vacuum taking an age