Deadlock with ShareLock problem on transaction on update

304 views Asked by At

I am seeing this error in my RDS logs in Postgresql.

Id column is Primary Key in my table.

I also logged the queries in server site and seen that both statements have different IDs.

Do you have any idea how can I fix this ?

Process 3095 waits for ShareLock on transaction 16391215; blocked by process 17623.
    Process 17623: 
            UPDATE dummytable
            SET latestheartbeat = $1
            WHERE
                id = $2
                AND (
                        latestheartbeat < $1
                        OR latestheartbeat is NULL
                    )
    Process 3095: 
            UPDATE dummytable
            SET latestheartbeat = $1
            WHERE
                id = $2
                AND (
                        latestheartbeat < $1
                        OR latestheartbeat is NULL
                    ) 
0

There are 0 answers