Re: [SQL] Questions about vacuum analyze

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Steven M(dot) Wheeler" <swheeler(at)sabre(dot)com>
Cc: pgsql-sql(at)hub(dot)org
Subject: Re: [SQL] Questions about vacuum analyze
Date: 1999-08-30 14:20:18
Message-ID: 5487.936022818@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Steven M. Wheeler" <swheeler(at)sabre(dot)com> writes:
> Does anyone have recommendations regarding vacuum analyze?
> Specifically:
> 1) Should it be run on a system that is quiet or will it run acceptably
> with other processes accessing the DB?

Vacuum will run fine, but it obtains an exclusive lock on each table
while it is working on that table. You are likely to find your other
processes waiting for the lock...

> 2) How often should it be run?

How fast does your database change?

I'd doubt that running vacuum analyze, as opposed to a plain vacuum,
needs to be done very often --- it's unlikely that the statistics
vacuum analyze measures are changing that fast, especially not in
million-row tables. The other function of vacuum is reclaiming space
from dead tuples, and the need for that depends on how often you update
or delete tuples.

I'm just guessing here, but a rule of thumb might be that it's worth
vacuuming when something like 20% of the tuples in your table are
dead, ie, the number of updates/deletes you've done since last vacuum
is about 20% of the table row count.

6.5 seems to have some performance problems with vacuuming large
indexes, BTW. We are looking into that, but in the meantime you might
experiment with dropping indexes on a table, vacuum table, recreating
indexes to see if that's faster than a straight vacuum.

regards, tom lane

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-08-30 14:43:54 Re: [SQL] problem with select
Previous Message José Soares 1999-08-30 13:04:12 Re: [SQL] datetime query issue