| От | Tom Lane |
|---|---|
| Тема | Re: deadlock avoidance |
| Дата | |
| Msg-id | 17858.1159235222@sss.pgh.pa.us обсуждение |
| Ответ на | deadlock avoidance (Clarence Gardner <clarence@silcom.com>) |
| Список | pgsql-general |
Clarence Gardner <clarence@silcom.com> writes:
> I noticed the following in some of our code today:
> select ... <join list> ... for update of a, b;
> Inasmuch as the cardinal rule for avoiding deadlocks is to acquire
> locks in a consistent order, should such a construction be avoided
> in favor of two separate "select ... for update" statements so that
> the order of acquisition of a and b is known?
If you're worried about deadlock, what you should be worrying about is
the order in which the individual rows are visited --- and splitting
this into two SQL commands doesn't in itself guarantee more about that
than the command as given.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера