英文:
reason for transaction holding snapshot (postgres, dbeaver)
问题
根据我的理解,我可以看到,一项交易通过pg_stat_activity
中的backend_xid
或backend_xmin
列之一不为NULL
来保持快照。
我目前正在调查来自dbeaver的会话中backend_xid
不为空的情况,但我不明白为什么这个交易需要一个快照。这很重要,因为持有快照的长时间运行交易可能会引发问题,例如自动清理。
我的问题是:我(服务器端)能找到交易为何保持快照的原因吗?是否有一个表可以显示交易为何保持快照?
英文:
As per my understanding, I can see that a transaction is holding a snapshot by either of the columns backend_xid
or backend_xmin
not being NULL
in pg_stat_activity
.
I am currently investigating cases where backend_xid
is not null for sessions from dbeaver and I don't understand why the transaction is requiring a snapshot. This is of interest as long running transaction that are holding a snapshot can cause problems, for autovacuum for instance.
My question is: Can I (serverside) find the reason why a transaction is holding a snapshot? Is there a table where I can see why the transaction is holding a snapshot?
答案1
得分: 1
backend_xid
是会话的事务ID,并不表示该会话具有活动快照。文档 表示:
如果有的话,这是该后端的顶层事务标识符。
backend_xmin
被描述为:
当前后端的
xmin
地平线。
"xmin
地平线" 是 PostgreSQL 术语,指的是在快照创建时活动的最低事务ID。它是 VACUUM
允许移除的上限。
英文:
backend_xid
is the transaction ID of the session and does not mean that the session has an active snapshot. The documentation says:
> Top-level transaction identifier of this backend, if any.
backend_xmin
is described as
> The current backend's xmin
horizon.
“xmin
horizon” is PostgreSQL jargon and refers to the lowest transaction ID that was active when the snapshot was taken. It is an upper limit of what VACUUM
is allowed to remove.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论