Re: postgresql93-9.3.5: deadlock when updating parent table expected?

Поиск
Список
Период
Сортировка
От Bill Moran
Тема Re: postgresql93-9.3.5: deadlock when updating parent table expected?
Дата
Msg-id 20150218134503.d40a2bff4ceb703824f2e43b@potentialtech.com
обсуждение исходный текст
Ответ на Re: postgresql93-9.3.5: deadlock when updating parent table expected?  (Dmitry O Litvintsev <litvinse@fnal.gov>)
Ответы Re: postgresql93-9.3.5: deadlock when updating parent table expected?  (dinesh kumar <dineshkumar02@gmail.com>)
Список pgsql-general
On Wed, 18 Feb 2015 18:30:09 +0000
Dmitry O Litvintsev <litvinse@fnal.gov> wrote:
>
> Yes, deadlock occurs when there are multiple processes insert
> concurrently into file table with the same volume id field.
> I used "sometimes"  as opposed to "all the time".

I resonded in that way since I frequently hear people complaining,
"we're seeing all kinds of deadlocks" as if the whole world is
collapsing under the deadlocks, but when pressed for more information
it turns out they're only seeing a few deadlocks per hour when the
system is under the heaviest load -- that scenario is hardly
unexpected. As a result, having more detailed information than
just "sometimes" helps to understand what's really going on.

> I think you advise to retry transaction or add select for update prior
> to insert. I will pursue this (together with upgrade to 9.3.6 suggested by
> Alvaro).

The nice thing about a retry strategy is that it always works.
The problem with a retry strategy is that it's easy to do wrong
(i.e. it may be more than just the transaction that needs to
restart ... depending on what data has changed, calculations may
need to be redone, the user requeried for certain information,
etc).

The problem with the SELECT ... FOR UPDATE is that it's a bit
slower, and can be significantly slower unders some circumstances,
but it's easier to implement correctly.

The good news form Alvaro is that this is probably happening more
frequently than necessary because of the bug he mentioned ... so
upgrading may cause the problem to happen infrequently enough that
you don't really care about it. The solutions I suggest are still
relevent, they just might not be as immediately important.

--
Bill Moran


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Starting new cluster from base backup
Следующее
От: dinesh kumar
Дата:
Сообщение: Re: postgresql93-9.3.5: deadlock when updating parent table expected?