Re: Foreign Key Deadlocking

Поиск
Список
Период
Сортировка
От Csaba Nagy
Тема Re: Foreign Key Deadlocking
Дата
Msg-id 1176992622.16187.97.camel@coppola.muc.ecircle.de
обсуждение исходный текст
Ответ на Re: Foreign Key Deadlocking  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-performance
> A frequently mentioned approach to avoid the point of contention is to
> have a "totals" record and have the triggers insert "deltas" records; to
> get the sum, add them all.  Periodically, take the deltas and apply them
> to the totals.

This is what we do here too. There is only one exception to this rule,
in one case we actually need to have the inserted records and the
updated parent in one transaction for data consistency, in that case the
delta approach won't work... we didn't find any other solution to that
except patching postgres not to lock the parent keys at all, which has
it's own problems too (occasional breakage of the foreign key
relationship when the parent is deleted and a child still slips in, but
this is very rare in our case not to cause problems which cannot be
cleaned up with relative ease - not to mention that there could be other
problems we didn't discover yet or our usage patterns are avoiding).

Cheers,
Csaba.



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Foreign Key Deadlocking
Следующее
От: "Michael Dengler"
Дата:
Сообщение: how to output column names