小编var*_*run的帖子

Postgres:事务上的 ShareLock 死锁

最近我们开始在日志中收到很多死锁错误。(Postgres 服务器 9.6.5)

我们的表由两列组成,一列是自增主键,另一列是 json 对象。来自 json 对象的两个属性被定义为 unique 。现在在日志中,我们不断收到错误,即不同行上的两个简单插入查询相互阻塞。

============

process 65325 detected deadlock while waiting for ShareLock on transaction 2934224126 after 1000.050 ms

DETAIL:  Process holding the lock: 35530. Wait queue: .

CONTEXT:  while inserting index tuple (128,10) in relation "A"

STATEMENT:  INSERT INTO A AS t (info) VALUES('{"x":"y",....)

ERROR:  deadlock detected

DETAIL:  Process 65325 waits for ShareLock on transaction 2934224126; blocked by process 35530.

Process 35530 waits for ShareLock on transaction 2934224125; blocked by process 65325.

Process …
Run Code Online (Sandbox Code Playgroud)

postgresql deadlock

7
推荐指数
1
解决办法
3624
查看次数

标签 统计

deadlock ×1

postgresql ×1