从简单的原子并发更新stmts获取死锁。有任何想法吗?

时间:2013-11-27 09:09:37

标签: c# sql sql-server sql-server-2012

以下是信息:

Transaction (Process ID 80) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

以下是查询:

update EDescriptionsCategories set CategoryId = Ids.CategoryId, AccessedDate = getdate() 
from EDescriptionsCategories 
join ( select * from (values (512528, 20870),(29596457, 20870)) as Ids(Id,CategoryId) ) as Ids on 
Ids.Id = EDescriptionsCategories.Id

以下是表格定义:

CREATE TABLE [dbo].[EDescriptionsCategories](
    [CategoryId] [int] NOT NULL,
    [AccessedDate] [datetime] NOT NULL,
    [Id] [int] NOT NULL,
 CONSTRAINT [PK_EDescriptionsCategories] PRIMARY KEY CLUSTERED 
(
    [Id] ASC
)

其中一些查询并行运行。为什么单个原子更新死锁?

没有针对此表运行其他查询。除主键外没有索引。然而,这是一张2100万行的大表。

0 个答案:

没有答案