Обсуждение: VACUUMing a live site OK?

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

VACUUMing a live site OK?

От
"Shuzo Kubo"
Дата:
Hi,

I have a web application using PostgreSQL 7.1.3 with a table that
experiences alot of UPDATEs. I shouldn't be updating the data so much to
start off with but can no longer avoid the situation.

I would like to vacuum a table (1 table only) to maintain an acceptable
performance. Is it safe to vacuum a table when users are attempting to
SELECT from or UPDATE to it? I would imagine that the table would get locked
and there should be no problems.

Any help is greatly appreciated. Thank you very much in advance.


Re: VACUUMing a live site OK?

От
Stephan Szabo
Дата:
On Fri, 19 Oct 2001, Shuzo Kubo wrote:

> Hi,
>
> I have a web application using PostgreSQL 7.1.3 with a table that
> experiences alot of UPDATEs. I shouldn't be updating the data so much to
> start off with but can no longer avoid the situation.
>
> I would like to vacuum a table (1 table only) to maintain an acceptable
> performance. Is it safe to vacuum a table when users are attempting to
> SELECT from or UPDATE to it? I would imagine that the table would get locked
> and there should be no problems.

That should be fine.  The vacuum should wait until any transactions
currently locking the table finish and any other transactions that want to
access the table should wait for the vacuum. One warning is that if you
have any kind of persistant connections, you may see things were a
transaction has a lock and goes idle (no statements) which will cause
the vacuum to sit and wait and other transactions to line up behind it.