Re: Strange deadlock in foreign key check

Поиск
Список
Период
Сортировка
От Sophia Wright
Тема Re: Strange deadlock in foreign key check
Дата
Msg-id CAJTwwh08=5tdg6sUreXJ1RM+j+FFONSSUzZXDrwvmXe1dkx7Tg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Strange deadlock in foreign key check  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Strange deadlock in foreign key check
Список pgsql-general
On Fri, Aug 7, 2015 at 2:46 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
I would also take a look at Alvaro's explanation. My understanding is that for locking purposes the UNIQUE index is considered sort of like a FK, as it could be used as a FK. This then leads to the FOR UPDATE lock, which from Table 13.3 at the link I sent, conflicts with all the other row locks.
 
Like I said, I think it would make sense for a UNIQUE index in pk_rel, i.e. the fk_rel insert would try to lock pk_rel.id with KEY SHARE, and would end up locking any other UNIQUE fields as a result.

But I can't see why the pk_rel deletion would want a KEY SHARE lock on fk_rel. It must be using FOR KEY SHARE rather than FOR UPDATE, since it does not conflict with the update of fk_rel.pk_id in the first example. So why lock fk_rel at all, if the lock doesn't include fk_rel.pk_id? Isn't that the only bit that matters to a pk_rel deletion?

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

Предыдущее
От: Melvin Davidson
Дата:
Сообщение: Re: How to intelligently work with views that depend on other views
Следующее
От: Melvin Davidson
Дата:
Сообщение: Re: How to intelligently work with views that depend on other views