小编mos*_*she的帖子

关于简单更新查询的postgres中的死锁

我正在使用postgres 9.1并在过度执行简单更新方法时获得死锁异常.

根据日志,由于同时执行两个相同的更新而发生死锁.

update public.vm_action_info set last_on_demand_task_id = $ 1,version = version + 1

两个相同的简单更新如何相互僵持?

我在日志中收到的错误

2013-08-18 11:00:24 IDT HINT:  See server log for query details.
2013-08-18 11:00:24 IDT STATEMENT:  update public.vm_action_info set last_on_demand_task_id=$1, version=version+1 where id=$2
2013-08-18 11:00:25 IDT ERROR:  deadlock detected
2013-08-18 11:00:25 IDT DETAIL:  Process 31533 waits for ShareLock on transaction 4228275; blocked by process 31530.
        Process 31530 waits for ExclusiveLock on tuple (0,68) of relation 70337 of database 69205; blocked by process 31533.
        Process 31533: update …
Run Code Online (Sandbox Code Playgroud)

postgresql postgresql-9.1

15
推荐指数
2
解决办法
4万
查看次数

标签 统计

postgresql ×1

postgresql-9.1 ×1