【发布时间】:2019-02-20 00:08:42
【问题描述】:
postgres 文档说:
“年龄列衡量从截止日期开始的交易数量 XID 到当前事务的 XID。"
【问题讨论】:
标签: postgresql database-administration
postgres 文档说:
“年龄列衡量从截止日期开始的交易数量 XID 到当前事务的 XID。"
【问题讨论】:
标签: postgresql database-administration
XID 只是序列号,因此计算 XID 的“年龄”是简单的减法,即:
age(datfrozenxid) = txid_current() - datfrozenxid
initdb 期间创建的数据以及 Postgres 9.4 之前冻结的数据的 XID 将始终报告 2147483647 的年龄。
age()函数的完整源代码(全部五行)可以在here找到。
【讨论】:
it is just the minimum of the per-table relfrozenxid values within the database