Live data from Hacker News

Select FOR UPDATE considered harmful in PostgreSQL

cybertec-postgresql.com

1–3 of 3 posts

Re: Select FOR UPDATE considered harmful in PostgreSQL

#3
> PostgreSQL takes FOR UPDATE on rows before a DELETE, or before an UPDATE that modifies a column that is part of a unique index that neither contains expressions nor is partial

This also happens when you UPDATE the same row twice within the same transaction.

https://goncalo.mendescabrita.com/blog/cross-table-lock/