Sql lock table while updating

In traditional relational literature an Update Lock is a so-called Asymmetric Lock.

Before we go down to the details of why they are needed, I first want to give you a basic overview of when an Update (U) Lock is acquired, and how the lock itself behaves regarding its compatibility.

cannot safely be executed concurrently with other operations on the same table, so it obtains an exclusive lock on the table to enforce that.) To examine a list of the currently outstanding locks in a database server, use the ; the names of the lock modes are historical.

To some extent the names reflect the typical usage of each lock mode — but the semantics are all the same.

(However, a transaction never conflicts with itself.

For example, it might acquire Once acquired, a lock is normally held till end of transaction.

When you normally read data through a SELECT statement, a Shared Lock is also good enough.

You must have an account to comment. Please register or login here!