| From: | Carlos Moreno <moreno(at)mochima(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Deadlocks -- what can I do about them? |
| Date: | 2004-08-23 21:06:15 |
| Message-ID: | 412A5C47.5070908@mochima.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
--
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ian Barwick | 2004-08-23 21:25:05 | Re: UTF-8 and LIKE vs = |
| Previous Message | David Wheeler | 2004-08-23 21:04:05 | Re: UTF-8 and LIKE vs = |