My investigation found the following query is causing high Lck_M_U wait. I noticed there are multiple instance of this query running obviously competing for the same resource. I wonder if there is anything I can do with this query (listed below) to minimize the wait?
UPDATE LBMebrs
SET DelayedPoints = 0, Points = ISNULL(computed.Points, 0)
FROM LBMebrs Le1
LEFT JOIN
(
SELECT lm.UserId, SUM(ua.Points) Points
FROM LBMebrs lm
INNER JOIN LBrds l ON l.Id = lm.LBrdsId
INNER JOIN UserActivities ua ON ua.UserId = lm.UserId
WHERE l.Id = @LBrdsId AND ua.Pub BETWEEN l.StartDate AND l.EndDate
GROUP BY lm.UserId
) computed ON computed.UserId = Le1.UserId
WHERE Le1.LBrdsId = @LBrdsId
Executions Plan:
https://www.brentozar.com/pastetheplan/?id=SJ0byVETr
Indexes defined on LBMebrs table:
Indexes defined on UserActivities Table
Indexes defined on LBrs Table
Multiple update queries running on instance (only once instance on whole server)
Waits on Server: