Re: How to explicitly lock and unlock tables in pgsql?

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: How to explicitly lock and unlock tables in pgsql?
Дата
Msg-id 3cc08f35825c14458c4cd345ef449211d37ddc49.camel@cybertec.at
обсуждение исходный текст
Ответ на Re: How to explicitly lock and unlock tables in pgsql?  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
On Fri, 2022-03-18 at 11:38 -0500, Merlin Moncure wrote:
> > Also, you should nevr explicitly lock tables.  Table locks are taken automatically
> > by the SQL statements you are executing.
> 
> Isn't that a bit of overstatement?
> LOCK table foo;
> 
> Locks the table, with the benefit you can choose the lockmode to
> decide what is and is not allowed to run after you lock it.  The main
> advantage vs automatic locking is preemptively blocking things so as
> to avoid deadlocks.

Yes, that was an overstatement.
But I find that 90% of the time when people explicitly lock a table
it is not the correct solution.

Yours,
Laurenz Albe




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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: How to explicitly lock and unlock tables in pgsql?
Следующее
От: "McDermott, Becky"
Дата:
Сообщение: Can you install/run postgresql on a FIPS enabled host?