Re: Debugging deadlocks

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Debugging deadlocks
Дата
Msg-id 20050328134715.GA29581@svana.org
обсуждение исходный текст
Ответ на Re: Debugging deadlocks  ("Guy Rouillier" <guyr@masergy.com>)
Список pgsql-general
On Sun, Mar 27, 2005 at 06:02:25PM -0600, Guy Rouillier wrote:
> With the current implementation, it appears I need to either (1) always
> commit after every inserted row, or (2) single thread my entire insert
> logic.  Neither of these two alternatives is very desirable.  And it is
> only a partial fix (which will work in my case since I'm the only one
> updating this database.)  In the general case though, where other
> programmers may be writing code that I may not even know about to update
> parts of this database, avoiding this type of deadlock becomes very
> difficult.  It pretty much requires that everyone know what everyone
> else is doing.

The other possibility is to sort the rows on the foreign key as they
are inserted. Then the locks will always be taken in the same order and
hence can never deadlock.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

Предыдущее
От: Gustavo Franklin Nóbrega - Planae
Дата:
Сообщение: Re: pg_xlog disk full error, i need help
Следующее
От: Christopher Browne
Дата:
Сообщение: Re: Linux Filesystem for PG