Sample Header Ad - 728x90

Why does parallelism cause lock escalation and where is the tipping point?

1 vote
1 answer
718 views
I use the customized Stack Overflow database (180GB) and run a simple update query: (there is only a clustered index on the Users table) Begin Tran Update U set U.Reputation=100000 from StackOverflow.dbo.Users as U where U.CreationDate = '2008-10-10 14:26:33.540' Query plan : enter image description here This query causes lock escalation. I can't run a query using the same table in another window:
select * from StackOverflow.dbo.Users as U where U.id=11
If I add option (maxdop 1) at the end of the query to avoid parallelism, everything is fine (plan ). Lock escalation does not occur in a smaller Stack Overflow DB (StackOverflow2013 - 52GB) (plan ). How to identify what amount of data is causing the escalation? I use SQL Server 2019. DB compatibility level is 150. Table info: * StackOverflow2013.dbo.Users -- 2 465 713 rows; 45 184 pages * StackOverflow.dbo.Users -- 8 917 507 rows; 143 667 pages
Asked by Aksel Rohtsalu (11 rep)
Feb 16, 2023, 12:43 PM
Last activity: Feb 17, 2023, 12:43 PM