Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Exclusive locks in SQL server-Update/Update

$
0
0

I have a basic and common question that which don't have perfect answer anywhere.
Scenario:
Transaction A and Transaction B is trying to update the same row in a table, which results in an exclusive locks. I know that is the default mechanism of the SQL server. But due to this, transaction B is waiting for long time until the completion of Transaction A. What if it happens when multiple transaction tries to update the same row. What is the best solution to mitigate this lock wait stats.

UPDATE dbo.table
   SET date_time_column = getdate() 
WHERE ID = @P0

Above is the update statement that is running from different treads and causing exclusive lock. What is the best possible solution to let my transactions run without this lock wait type.


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>