Expert SQL Server Transactions and Locking by Dmitri Korotkevitch

Expert SQL Server Transactions and Locking by Dmitri Korotkevitch

Author:Dmitri Korotkevitch
Language: eng
Format: epub
ISBN: 9781484239575
Publisher: Apress


begin tran

while @id < 100000

begin

update Delivery.Orders

set OrderStatusId = 1

where OrderId between @id and @id + 4998;

select @id += 4999;

end

select count(*) as [Lock Count]

from sys.dm_tran_locks

where request_session_id = @@SPID;

commit

Listing 7-1Lock escalation and multiple statements

Figure 7-3 shows the output of the SELECT statement from Listing 7-1. Even when the total number of locks the transaction holds is far more than the threshold, lock escalation is not triggered.

Figure 7-3Number of locks held by the transaction



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.