|
|
|
|
|
by Alpi
970 days ago
|
|
FOR UPDATE locks the row for other blocking transactions (including another select for update)
The weaker form that only locks updates and deletes is called FOR SHARE.
Transaction isolation levels do not make a difference here. https://www.postgresql.org/docs/current/explicit-locking.htm... So the article is correct that SELECT FOR UPDATE will ensure that another concurrent SELECT FOR UPDATE transaction never acquire the same row (it will block), though nothing prevents other non-blocking selects to query this row concurrently. You can think of it as usual locks - only the threads that explicitly use the same lock have the mutual exclusion guarantees. If there’s another thread that does not acquire the lock and tries to access the critical section - it will be able to do so. |
|