Pro Programmer: Locks

Tuesday, August 14, 2012

Locks

Shared Lock: It is used when you only need to read the data. It prevents users from performing dirty reads.

Exclusive Lock: As the name suggests, it is not compatible with any other lock. It prevents two people from updating or deleting data at the same time.

Update Lock: Indicates that you have a shared lock that's going to become an exclusive lock after doin your initial scan of the data (to figure out what, if needed, needs to be updated). If you do not change the data then it just stays as a shared lock.

Intent Lock: It's used to deal with object hierarchies. Intent locks has two purposes:
  • Prevent other transactions from modifying the higher-level resource in a way that would invalidate the lock at the lower level.
  • Improves the efficiency of the Database Engine in detecting lock conflicts at the higher level of granularity.

No comments:

Post a Comment