A very common question I often get in the email is
“What is the difference between latches and locks?”
The answer to this question is not an easy one. Here is a quick answer from the MS white paper.
A page in SQL Server is 8KB and can store multiple rows. To increase concurrency and performance, buffer latches are held only for the duration of the physical operation on the page, unlike locks which are held for the duration of the logical transaction. Latches are internal to the SQL engine and are used to provide memory consistency, whereas locks are used by SQL Server to provide logical transactional consistency.
Above answer is taken from the old, but extremely relevant white paper written in the year 2011. It was written for SQL Server 2008 R2, however, almost all the concepts from this Whitepaper are still very accurate.
If you want to learn more about Latches and how to diagnose and resolve problems around latch contention, I strongly suggest following whitepaper.
Let me know your thoughts about this subject.
Reference: Pinal Dave (https://blog.sqlauthority.com)