postgresql 并发访问_postgresql 并发update下导致的死锁问题

一、死锁问题背景

在收据批量打印时,由于采用异步并发触发打印,同时触发打印(九千多数据 每隔50ms触发一次),导致了并发执行引起在接口更新打印次数时postgresql发生死锁问题,

具体报错如下:

1 ### The error occurred whilesetting parameters2 ### SQL: update t_sc_receipt set print_num = coalesce(print_num,0) + 1 ,print_ts=?

3 ### Cause: org.postgresql.util.PSQLException: ERROR: deadlock detected4 详细:Process 19540 waits for ShareLockon transaction 12520113; blocked by process 19539.5 Process 19539 waits for ShareLock on transaction 12520112; blocked by process 19540.6 建议:See server log forquery details.7 在位置:while rechecking updated tuple (329,3) in relation "t_sc_receipt"

8 ; SQL []; ERROR: deadlock detected9 详细:Process 19540 waits for ShareLock on transaction 12520113; blocked by process 19539.10 Process 19539 waits for ShareLock on transaction 12520112; blocked by process 19540.11 建议:See server log forquery details.12 在位置:while rechecking updated tuple (329,3) in relation "t_sc_receipt"; nested exception is org.postgresql.util.PSQLException: ERROR: deadlock detected13 详细:Process 19540 waits for ShareLock on transaction 12520113; blocked by process 19539.14 Process 19539 waits for ShareLock on transaction 12520112; blocked by process 19540.15 建议

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值