Re: Re: VACUUM is hanging

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: VACUUM is hanging
Дата
Msg-id 4278.989034847@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: VACUUM is hanging  (Ashley Clark <aclark@ghoti.org>)
Список pgsql-general
Ashley Clark <aclark@ghoti.org> writes:
>> Try not to leave open transactions hanging around in your Apache
>> code. An idle database connection couldn't block VACUUM like that;
>> it'd have to have been in the middle of a BEGIN block, or maybe even
>> an unfinished query.

> That appears to be the culprit. I don't really understand why an
> uncommitted SELECT statement could/should lock the table though. How
> does that differ from just an open transaction where no query has
> happened yet?

If you've just done BEGIN then you aren't holding any locks.  But having
done a SELECT, you have a read lock on that table, which will persist
until you commit or abort the transaction.  A read lock doesn't normally
prevent other transactions from doing things with the table --- but it
does block "exclusive" locks, which are obtained for actions like DROP
TABLE, ALTER TABLE, and VACUUM.  Those guys want to know that there
ain't no one messin' with that table.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: "David Wall"
Дата:
Сообщение: Re: VACUUM is hanging
Следующее
От: "Muhammad Rusydi"
Дата:
Сообщение: Re: how can i get plpgsql in function?