Sample Header Ad - 728x90

Differences of latch and lock

2 votes
1 answer
1801 views
Recently when i was trying to find information about latch_ex wait type, i come across one blog as below which stated about latch and lock. enter image description here After reading this blog , i m just curious in one thing. When app submit a request, SQL server will look for the information in buffer cache first and if the page not in buffer cache ,then only it will read from disk and put it in buffer cache before send info to app. My question based on the screenshot as above where it stated latch and lock need to avoid two thread updating same page. Basically all request come to SQL server will go to buffer cache first, if the page in buffer cache is busy updating, another thread will have to wait. It wont go back to disk because the page already in memory. Then what is the purpose of lock since every request will be done through memory and there is latch to protect the page
Asked by jack (79 rep)
Nov 9, 2019, 04:29 PM
Last activity: Nov 9, 2019, 07:00 PM