Обсуждение: Vacuum strategies

Поиск
Список
Период
Сортировка

Vacuum strategies

От
"Michael Mattox"
Дата:
When I run vacuum (I usually do "vacuum full verbose analyze"), I get a
message saying vacuum should only be performed when no one is using the
database.  My database is used for a website which is active 24 hours a day,
so I'm curious what kind of vacuum strategy I should use?  Should I shut
down the website to vacuum or should I just schedule the vacuum to run in
the middle of the night?  So far I've been doing it while the website is
running without any problems.

Thanks,
Michael Mattox




Re: Vacuum strategies

От
Bruno Wolff III
Дата:
On Thu, May 29, 2003 at 12:21:44 +0200,
  Michael Mattox <michael.mattox@verideon.com> wrote:
> When I run vacuum (I usually do "vacuum full verbose analyze"), I get a
> message saying vacuum should only be performed when no one is using the
> database.  My database is used for a website which is active 24 hours a day,
> so I'm curious what kind of vacuum strategy I should use?  Should I shut
> down the website to vacuum or should I just schedule the vacuum to run in
> the middle of the night?  So far I've been doing it while the website is
> running without any problems.

Vacuum full exclusively locks tables and can hurt performance if
tables are big. If you are running 7.3, you normally won't need to
run vacuum full. Vacuum should be run when a significant fraction of
rows in a table have been deleted or updated or at least every
10^9 transactions. Analyse needs to be run after inserts, updates
or deletes have significantly impacted the statistics for a table.