Co-Authored By:

Asked by: Ibrain Gagarin
technology and computing databasesWhat is the difference between a shared lock and an exclusive lock?
Besides, what is an exclusive lock?
Exclusive locks. When a statement modifies data, its transaction holds an exclusive lock on data that prevents other transactions from accessing the data. This lock remains in place until the transaction holding the lock issues a commit or rollback. Table-level locking lowers concurrency in a multi-user system.
Also Know, what is a shared lock?
Shared locks exist when two transactions are granted read access. One transaction gets the shared lock on data and when the second transaction requests the same data it is also given a shared lock. Shared locks last as long as they need to last; it depends on the level of the transaction that holds the lock.
Exclusive lock mode prevents the associates resource from being shared. This lock mode is obtained to modify data. The first transaction to lock a resource exclusively is the only transaction that can alter the resource until the exclusive lock is released.