在运行 SQL Server Profiler 时,我遇到了一些 Lock:Escalations。当我搜索具有与 Lock:Escalation 事件相同的 SPID 的语句时,我意识到删除语句之一会导致这种情况。
有什么方法可以找出为什么在这样的地方发生锁升级?
声明就像:
delete from BOOK_IN_LIBRARY where libraryId in (,,,,); <-20 elements ids
CREATE TABLE BOOK_IN_LIBRARY(
[libraryId] [bigint] NOT NULL,
[bookId] [bigint] NULL,
[otherData] [bigint]NULL,
[otherData2] [int] NULL,
[otherData3] [int] NOT NULL,
PRIMARY KEY CLUSTERED
(
[libraryId] ASC,
[bookId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]