[英]Lock table on postgresql 9.6
i'm new in postgres administration and when developper run LOCK TABLE tab1;
我是 postgres 管理的新手,当开发人员运行
LOCK TABLE tab1;
with PREPARED
statement , postgres use ACCES EXCLUSIVE
BY DEFAULT.对于
PREPARED
语句,postgres 使用ACCES EXCLUSIVE
BY DEFAULT。 My probelem is that the lock in table is still here after one week in view pg_prepared_xact
and pg_locks
even after restart of postgres and in pg_lock is like:我的问题是,即使在重新启动 postgres 和 pg_lock 之后,在视图
pg_prepared_xact
和pg_locks
中,表中的锁在一周后仍然存在,如下所示:
vXID mode
-1/192836 AccessExclusiveLock
Name DATABASE Owner XID prepared at
db1 postgres 192836 20-07-2021
I would know why the LOCK is still here??我会知道为什么 LOCK 还在这里? and how to solve it?
以及如何解决? and what is mean -1 in vXID??
vXID 中的 -1 是什么意思? because i can't even show my data on
tab1
因为我什至无法在
tab1
上显示我的数据
with PREPARED statement
带有 PREPARED 语句
Prepared transactions and prepared statements are very different things.准备好的事务和准备好的语句是非常不同的东西。 What you have here is a prepared transaction.
你在这里拥有的是一个准备好的交易。 Surviving a restart is what prepared transactions are for .
幸存的重启是什么准备交易的。 You need to find its "gid" in pg_prepared_xacts and then either manually commit it or roll it back .
您需要在 pg_prepared_xacts 中找到它的“gid”,然后手动提交或 回滚。 If you are not intentionally using prepared transactions, the you should set max_prepared_transactions =0, so this can't recur.
如果您不是有意使用准备好的事务,您应该设置 max_prepared_transactions =0,这样就不会再发生。 If you are intentionally using them, you need to learn how to handle them.
如果您有意使用它们,则需要学习如何处理它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.