2021年3月31日星期三

In a database with shared/exclusive locks, when an UPDATE statement is executed at the beginning of the transaction, how do the locks work?

In a database with shared/exclusive locks, when an UPDATE statement is executed at the beginning of the transaction, how do the locks work? Assuming Repeatable Read or higher, does it get a shared lock during the reading and searching stage and then an exclusive lock, or does it get an exclusive lock from the beginning? Assuming Read Committed, does an UPDATE statement get the exclusive lock only at the write stage, or does it get it as soon as it starts to read? I'm using PostgreSQL.

https://stackoverflow.com/questions/66896848/in-a-database-with-shared-exclusive-locks-when-an-update-statement-is-executed April 01, 2021 at 08:10AM

没有评论:

发表评论