#StackBounty: #postgresql #update #deadlock #postgresql-9.5 Possible for two simple updates on the same table to deadlock?

Bounty: 100

Table A is:

id integer
version varchar
data jsonb (large data 1mb)
fkToBid integer (references B.id constraint)

Table B is:

id integer

Processes are aggressively running the two updates below, in any order and outside any transaction.

Updated records in table A sometimes refer to the same record in table B. Also, sometimes the same A record is updated.

UPDATE A.version WHERE A.id=:id
UPDATE A.data WHERE A.id=:id

Why, or can, this deadlock? Is it because updated records in table A refer to the same row in table B? Can this deadlock for another reason?

Why do I see an AccessShareLock on the B pk index for these update requests?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.