Postgresql Deadlock - what does “while rechecking updated tuple” mean?Deadlock during Slony uninstall and...

What is the difference between crontab -e and nano /etc/crontab?

How can I portray body horror and still be sensitive to people with disabilities?

Sauna: Wood does not feel so hot

Why do we divide Permutations to get to Combinations?

Rudeness by being polite

In a world with multiracial creatures, what word can be used instead of mankind?

Which was the first story to feature space elevators?

Taking an academic pseudonym?

Why don't reads from /dev/zero count as I/O?

Ramanujan's radical and how we define an infinite nested radical

Stream.findFirst different than Optional.of?

How to encircle section of matrix in LaTeX?

Why is quixotic not Quixotic (a proper adjective)?

Cryptic cross... with words

Why are `&array` and `array` pointing to the same address?

Exploding Numbers

The Longest Chess Game

Is it ethical to apply for a job on someone's behalf?

Is layered encryption more secure than long passwords?

Microphone on Mars

Why is Bernie Sanders maximum accepted donation on actblue $5600?

What dissuades people from lying about where they live in order to reduce state income taxes?

Short story where Earth is given a racist governor who likes species of a certain color

Found a major flaw in paper from home university – to which I would like to return



Postgresql Deadlock - what does “while rechecking updated tuple” mean?


Deadlock during Slony uninstall and concurrent access of DBCannot fetch the rowset from OLE DB provider “SQLNCLI” for linked server Xhow to avoid deadlock while updating 2 rows in mysqlSQL Server: deadlocked on lock communication buffer resourcesSingle DELETE statement deadlocking in Sybase ASEDeadlock detected on CREATE TABLE in PostgreSQLSimultaneous calls to the same function: how are deadlocks occurring?Why does Deadlock occur for this INSERT/UPDATE combination despite seemingly holding an X lock?What kind of deadlock the deadlock_timeout config parameter detects in Postgresql?Deadlock with two update queries













1















Question: Can someone please decipher while rechecking updated tuple for me?



ERROR:  deadlock detected
DETAIL:
Process 31391 waits for ShareLock on transaction 770573675; blocked by process 25788.
Process 25788 waits for ShareLock on transaction 770573695; blocked by process 31391.
Process 31391: update my_table row_to_update set col_to_update = now() from (select id from my_table where col_to_update is null order by id limit $4 for no key update) matched_row_to_update where row_to_update.id = matched_row_to_update.id returning row_to_update.id as id, row_to_update.col_to_update as col_to_update, row_to_update.other_col as other_col
Process 25788: update my_table set col_to_update=$1 other_col=$2 where id=$3
HINT: See server log for query details.
CONTEXT: while rechecking updated tuple (36328,33) in relation "my_table"


I found the it here but couldn't figure it out what exactly is happening there. what is the lock? and how can I debug/resolve it?



To be clear I understand what a deadlock is. I'm asking, based on the error message what is happening, or very simply what the error message means. For example, https://bit.ly/2TaWh6c or https://bit.ly/2Sk0lg0 or https://bit.ly/2E2v9g9 describe different situations with different error message. But I couldn't find anything about the error I'm getting.



A little background:

previously we had deadlock errors with the message: while updating tuple (xxx,xxx) in relation my_table between the two transaction with the same query (the first query in the above). We managed to solve it by adding order by id for no key update. But now, it's a new deadlock which I can't resolve.










share|improve this question









New contributor




Rad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • You should just catch the error and retry the transaction, at the application/framework/abstraction layer. Anything else could be an endless game of whack-a-mole. If you want to play the whack-a-mole game, then what do you see in the server log file about the other transactions involved in this deadlock?

    – jjanes
    1 min ago
















1















Question: Can someone please decipher while rechecking updated tuple for me?



ERROR:  deadlock detected
DETAIL:
Process 31391 waits for ShareLock on transaction 770573675; blocked by process 25788.
Process 25788 waits for ShareLock on transaction 770573695; blocked by process 31391.
Process 31391: update my_table row_to_update set col_to_update = now() from (select id from my_table where col_to_update is null order by id limit $4 for no key update) matched_row_to_update where row_to_update.id = matched_row_to_update.id returning row_to_update.id as id, row_to_update.col_to_update as col_to_update, row_to_update.other_col as other_col
Process 25788: update my_table set col_to_update=$1 other_col=$2 where id=$3
HINT: See server log for query details.
CONTEXT: while rechecking updated tuple (36328,33) in relation "my_table"


I found the it here but couldn't figure it out what exactly is happening there. what is the lock? and how can I debug/resolve it?



To be clear I understand what a deadlock is. I'm asking, based on the error message what is happening, or very simply what the error message means. For example, https://bit.ly/2TaWh6c or https://bit.ly/2Sk0lg0 or https://bit.ly/2E2v9g9 describe different situations with different error message. But I couldn't find anything about the error I'm getting.



A little background:

previously we had deadlock errors with the message: while updating tuple (xxx,xxx) in relation my_table between the two transaction with the same query (the first query in the above). We managed to solve it by adding order by id for no key update. But now, it's a new deadlock which I can't resolve.










share|improve this question









New contributor




Rad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • You should just catch the error and retry the transaction, at the application/framework/abstraction layer. Anything else could be an endless game of whack-a-mole. If you want to play the whack-a-mole game, then what do you see in the server log file about the other transactions involved in this deadlock?

    – jjanes
    1 min ago














1












1








1








Question: Can someone please decipher while rechecking updated tuple for me?



ERROR:  deadlock detected
DETAIL:
Process 31391 waits for ShareLock on transaction 770573675; blocked by process 25788.
Process 25788 waits for ShareLock on transaction 770573695; blocked by process 31391.
Process 31391: update my_table row_to_update set col_to_update = now() from (select id from my_table where col_to_update is null order by id limit $4 for no key update) matched_row_to_update where row_to_update.id = matched_row_to_update.id returning row_to_update.id as id, row_to_update.col_to_update as col_to_update, row_to_update.other_col as other_col
Process 25788: update my_table set col_to_update=$1 other_col=$2 where id=$3
HINT: See server log for query details.
CONTEXT: while rechecking updated tuple (36328,33) in relation "my_table"


I found the it here but couldn't figure it out what exactly is happening there. what is the lock? and how can I debug/resolve it?



To be clear I understand what a deadlock is. I'm asking, based on the error message what is happening, or very simply what the error message means. For example, https://bit.ly/2TaWh6c or https://bit.ly/2Sk0lg0 or https://bit.ly/2E2v9g9 describe different situations with different error message. But I couldn't find anything about the error I'm getting.



A little background:

previously we had deadlock errors with the message: while updating tuple (xxx,xxx) in relation my_table between the two transaction with the same query (the first query in the above). We managed to solve it by adding order by id for no key update. But now, it's a new deadlock which I can't resolve.










share|improve this question









New contributor




Rad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












Question: Can someone please decipher while rechecking updated tuple for me?



ERROR:  deadlock detected
DETAIL:
Process 31391 waits for ShareLock on transaction 770573675; blocked by process 25788.
Process 25788 waits for ShareLock on transaction 770573695; blocked by process 31391.
Process 31391: update my_table row_to_update set col_to_update = now() from (select id from my_table where col_to_update is null order by id limit $4 for no key update) matched_row_to_update where row_to_update.id = matched_row_to_update.id returning row_to_update.id as id, row_to_update.col_to_update as col_to_update, row_to_update.other_col as other_col
Process 25788: update my_table set col_to_update=$1 other_col=$2 where id=$3
HINT: See server log for query details.
CONTEXT: while rechecking updated tuple (36328,33) in relation "my_table"


I found the it here but couldn't figure it out what exactly is happening there. what is the lock? and how can I debug/resolve it?



To be clear I understand what a deadlock is. I'm asking, based on the error message what is happening, or very simply what the error message means. For example, https://bit.ly/2TaWh6c or https://bit.ly/2Sk0lg0 or https://bit.ly/2E2v9g9 describe different situations with different error message. But I couldn't find anything about the error I'm getting.



A little background:

previously we had deadlock errors with the message: while updating tuple (xxx,xxx) in relation my_table between the two transaction with the same query (the first query in the above). We managed to solve it by adding order by id for no key update. But now, it's a new deadlock which I can't resolve.







postgresql deadlock






share|improve this question









New contributor




Rad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Rad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago







Rad













New contributor




Rad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 6 hours ago









RadRad

1064




1064




New contributor




Rad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Rad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Rad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • You should just catch the error and retry the transaction, at the application/framework/abstraction layer. Anything else could be an endless game of whack-a-mole. If you want to play the whack-a-mole game, then what do you see in the server log file about the other transactions involved in this deadlock?

    – jjanes
    1 min ago



















  • You should just catch the error and retry the transaction, at the application/framework/abstraction layer. Anything else could be an endless game of whack-a-mole. If you want to play the whack-a-mole game, then what do you see in the server log file about the other transactions involved in this deadlock?

    – jjanes
    1 min ago

















You should just catch the error and retry the transaction, at the application/framework/abstraction layer. Anything else could be an endless game of whack-a-mole. If you want to play the whack-a-mole game, then what do you see in the server log file about the other transactions involved in this deadlock?

– jjanes
1 min ago





You should just catch the error and retry the transaction, at the application/framework/abstraction layer. Anything else could be an endless game of whack-a-mole. If you want to play the whack-a-mole game, then what do you see in the server log file about the other transactions involved in this deadlock?

– jjanes
1 min ago










1 Answer
1






active

oldest

votes


















1














I assume you understand what a deadlock is. If you don't, you'll find more informations here and here.



It's particularly difficult for a human brain to imagine concurrency in data writing/reading (as real time programmation is difficult for a human brain). So you should consider applying these two simple rules in your application for DML:




  • Always write data in the same order in your transactions

  • Keep your transactions short (the shortest you can)






share|improve this answer
























  • Thanks for the answer. Yes I understand what a deadlock is. I'm asking based on the error message what is happening, or very simply what the error message means. For example, bit.ly/2TaWh6c or bit.ly/2Sk0lg0 or bit.ly/2E2v9g9 describe different situations with different error message. But I couldn't find anything about the error I'm getting.

    – Rad
    3 hours ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Rad is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f230357%2fpostgresql-deadlock-what-does-while-rechecking-updated-tuple-mean%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














I assume you understand what a deadlock is. If you don't, you'll find more informations here and here.



It's particularly difficult for a human brain to imagine concurrency in data writing/reading (as real time programmation is difficult for a human brain). So you should consider applying these two simple rules in your application for DML:




  • Always write data in the same order in your transactions

  • Keep your transactions short (the shortest you can)






share|improve this answer
























  • Thanks for the answer. Yes I understand what a deadlock is. I'm asking based on the error message what is happening, or very simply what the error message means. For example, bit.ly/2TaWh6c or bit.ly/2Sk0lg0 or bit.ly/2E2v9g9 describe different situations with different error message. But I couldn't find anything about the error I'm getting.

    – Rad
    3 hours ago
















1














I assume you understand what a deadlock is. If you don't, you'll find more informations here and here.



It's particularly difficult for a human brain to imagine concurrency in data writing/reading (as real time programmation is difficult for a human brain). So you should consider applying these two simple rules in your application for DML:




  • Always write data in the same order in your transactions

  • Keep your transactions short (the shortest you can)






share|improve this answer
























  • Thanks for the answer. Yes I understand what a deadlock is. I'm asking based on the error message what is happening, or very simply what the error message means. For example, bit.ly/2TaWh6c or bit.ly/2Sk0lg0 or bit.ly/2E2v9g9 describe different situations with different error message. But I couldn't find anything about the error I'm getting.

    – Rad
    3 hours ago














1












1








1







I assume you understand what a deadlock is. If you don't, you'll find more informations here and here.



It's particularly difficult for a human brain to imagine concurrency in data writing/reading (as real time programmation is difficult for a human brain). So you should consider applying these two simple rules in your application for DML:




  • Always write data in the same order in your transactions

  • Keep your transactions short (the shortest you can)






share|improve this answer













I assume you understand what a deadlock is. If you don't, you'll find more informations here and here.



It's particularly difficult for a human brain to imagine concurrency in data writing/reading (as real time programmation is difficult for a human brain). So you should consider applying these two simple rules in your application for DML:




  • Always write data in the same order in your transactions

  • Keep your transactions short (the shortest you can)







share|improve this answer












share|improve this answer



share|improve this answer










answered 5 hours ago









ArkhenaArkhena

84918




84918













  • Thanks for the answer. Yes I understand what a deadlock is. I'm asking based on the error message what is happening, or very simply what the error message means. For example, bit.ly/2TaWh6c or bit.ly/2Sk0lg0 or bit.ly/2E2v9g9 describe different situations with different error message. But I couldn't find anything about the error I'm getting.

    – Rad
    3 hours ago



















  • Thanks for the answer. Yes I understand what a deadlock is. I'm asking based on the error message what is happening, or very simply what the error message means. For example, bit.ly/2TaWh6c or bit.ly/2Sk0lg0 or bit.ly/2E2v9g9 describe different situations with different error message. But I couldn't find anything about the error I'm getting.

    – Rad
    3 hours ago

















Thanks for the answer. Yes I understand what a deadlock is. I'm asking based on the error message what is happening, or very simply what the error message means. For example, bit.ly/2TaWh6c or bit.ly/2Sk0lg0 or bit.ly/2E2v9g9 describe different situations with different error message. But I couldn't find anything about the error I'm getting.

– Rad
3 hours ago





Thanks for the answer. Yes I understand what a deadlock is. I'm asking based on the error message what is happening, or very simply what the error message means. For example, bit.ly/2TaWh6c or bit.ly/2Sk0lg0 or bit.ly/2E2v9g9 describe different situations with different error message. But I couldn't find anything about the error I'm getting.

– Rad
3 hours ago










Rad is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Rad is a new contributor. Be nice, and check out our Code of Conduct.













Rad is a new contributor. Be nice, and check out our Code of Conduct.












Rad is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Database Administrators Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f230357%2fpostgresql-deadlock-what-does-while-rechecking-updated-tuple-mean%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Szabolcs (Ungheria) Altri progetti | Menu di navigazione48°10′14.56″N 21°29′33.14″E /...

Discografia di Klaus Schulze Indice Album in studio | Album dal vivo | Singoli | Antologie | Colonne...

How to make inet_server_addr() return localhost in spite of ::1/128RETURN NEXT in Postgres FunctionConnect to...