Laurenz Albe explains why SELECT FOR UPDATE is rarely the right call:
Recently, while investigating a deadlock for a customer, I was again reminded how harmful
SELECT FOR UPDATE
can be for database concurrency. This is nothing new, but I find that many people don’t know about the PostgreSQL row lock modes. So here I’ll write up a detailed explanation to let you know when to avoidSELECT FOR UPDATE
.
Click through for the full explanation.