Difference Between Latches and Locks

A latch is utilized to cordinate the physical execution of various strings inside a database, though a lock is utilized on a coherent level to accomplish the required seclusion dependent on the picked detachment level of the exchange. You, as a developer or DBA, can impact secures a few different ways – for example through the isolation level, or additionally through the different lock hints that are accessible in SQL Server. A lock then again, can’t be controlled in an immediate manner. There are no latch implies in SQL Server, and there is likewise no lock isolation level accessible. The accompanying table thinks about locks and latches against one another.


  1. Locks are generally bolstered by the framework and in the event that that they are taken, your string will be put to rest so it won’t expend any processor assets. Each lock keeps an inner line of every suspended string.
  2. The lock director is the subsystem that can give you as turn bolts as heavyweight locks for simultaneous support.
  3. Protects the index’s logical substance from different txns.
  4. Held for txn length.
  5. Need to have the option to rollback changes.


  1. Latches resemble locks for RAM memory structures to anticipate simultaneous access and guarantee sequential execution of piece code. The locks are utilized when chasing, including, or expelling a cushion from the support reserve, an activity that must be finished by one procedure at once.
  2. Latches are momentary light weight synchronization objects. In contrast to locks, hooks don’t hold till the whole legitimate exchange. They hold just on the activity on the page.
  3. Protects the basic segments of the index’s inner information structure from different threads.
  4. Held for activity term.
  5. Do not should probably rollback changes.

Latches are utilized by the engine for synchronization of numerous threads (for instance attempting to embed on a table). Hooks are not for engineer or application – it is for the motor to carry out it’s responsibility. Latches are inner control system. While locks are for the engineer and application to control. Locks are for interior memory consistency. Locks are for consistent value-based consistency.

Leave a Reply

Your email address will not be published. Required fields are marked *