From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Thomas Poty <thomas(dot)poty(at)gmail(dot)com> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: algo for canceling a deadlocked transaction |
Date: | 2018-04-09 13:51:21 |
Message-ID: | 20180409135121.GJ27724@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Greetings,
* Thomas Poty (thomas(dot)poty(at)gmail(dot)com) wrote:
> My question is : In case of a deadlock between 2 transaction, how to know
> which transaction will be canceled? Is it predictable?
The short answer is "it's whichever one detected the deadlock." The
deadlock timeout fires after a lock has been held that long and if a
deadlock is detected then the process detecting it will be canceled.
I'd strongly recommend reviewing your application and addressing
deadlocks by changing how the application acquires locks to be
consistent and to avoid lock escalation instead of worrying about how to
predict a deadlock- a properly designed and written application
shouldn't be causing deadlocks to happen in the first place.
Thanks!
Stephen
From | Date | Subject | |
---|---|---|---|
Next Message | Melvin Davidson | 2018-04-09 13:57:18 | Re: Rationale for aversion to the central database? |
Previous Message | Thomas Poty | 2018-04-09 13:46:52 | algo for canceling a deadlocked transaction |