Deadlocks -- what can I do about them?

Поиск
Список
Период
Сортировка
От Carlos Moreno
Тема Deadlocks -- what can I do about them?
Дата
Msg-id 412A5C47.5070908@mochima.com
обсуждение исходный текст
Ответы How is this possible? (more on deadlocks)  (Carlos Moreno <moreno@mochima.com>)
Список pgsql-general
Hello,

I'm using PostgreSQL 7.4.3 on a RedHat 9 Linux server
(a P4 HyperThreaded, using the SMP kernel, in case this
makes a difference).

I'm not 100% sure I understand exactly why I am causing
them, but let's say that several inserts inside an SQL
transaction (i.e., a BEGIN / COMMIT-ROLLBACK block),
where each insert references two different foreign-keys
kind of sets the alarm.

The thing is, what can I do?  Is it ok if I check the
error and whenever a deadlock is detected, a execute
a delay of some random number of milliseconds and
then try again?

After some preliminary analysis, I'm not sure there is
anything (sensible) that I can do about those SQL insert
statements or the fact that they're enclosed in an SQL
transaction.  I can't seem to see why those would be
fundamentally wrong.  That's why I'm looking for a
solution that may involve recovering from the error.
The transaction has been rolled back, so I'm guessing
I could try again a little bit later, no?

Is there some standard practice to deal with these
deadlocks, or to avoid them in a situation like I
described (I know, I didn't post any details, but
details would only bore you at this point, I guess)

Thanks for any advice/comments,

Carlos
--



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

Предыдущее
От: David Wheeler
Дата:
Сообщение: Re: UTF-8 and LIKE vs =
Следующее
От: Ian Barwick
Дата:
Сообщение: Re: UTF-8 and LIKE vs =