CREATE TABLE [dbo].[WKF_EXEC_HTR](
[MODULE_ID] [int] NULL,
[SESSION_ID] [int] NULL,
[Request_id] [int] NULL,
[wkf_exec_htry_seq] [int] IDENTITY(1,1) NOT NULL,
CONSTRAINT [pk_wkf_exec_htr] PRIMARY KEY CLUSTERED
(
[wkf_exec_htry_seq] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF)
ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF GO
ALTER TABLE [dbo].[WKF_EXEC_HTR] WITH CHECK ADD CONSTRAINT [FK_WKF_EXEC_HTR_SESSION_ID] FOREIGN KEY([SESSION_ID])
REFERENCES [dbo].[SESN] ([SESSION_ID])
GO
ALTER TABLE [dbo].[WKF_EXEC_HTR] CHECK CONSTRAINT [FK_WKF_EXEC_HTR_SESSION_ID]
我在[wkf_exec_htry_seq]上有一个主键和聚集索引。当多个进程尝试在此表中插入时,它会导致死锁,无论如何避免此死锁。