Sunday, August 21, 2011

Different kind of Lock processes

An RDBMS processes a large number of transactions simultaneously. A lock synchronizes simultaneous accesses to an object. When a transaction access an object, the object is temporarily locked to prevent other transactions from accessing it simultaneously.

The type of lock determines which operations from other transactions can be executed on the locked object. Types of locks are:
1) Shared (S) : Used for operations that do not change or update data (read-only operations), such as SELECT statement.
2) Exclusive (E) : Used for data modification operations, such as UPDATE, INSERT or DELETE. This type of lock ensures that multiple updates cannot be made to the same resource at the same time.
3) Update (U) : Used on resources that can be updated. This type of lock prevents a common form of deadlock that occurs when multiple sessions are reading, locking, and potentially updating resources later.
4) Intent (I) : Used to establish a lock hierarchy.
5) Schema (Sch) : Used when an operation dependent on the schema of table is being executed.

 Lock resources: