Postgresql 中文操作指南

54.16. pg_prepared_xacts #

视图 pg_prepared_xacts 显示了当前为两阶段提交准备的事务信息(有关详细信息,请参阅 PREPARE TRANSACTION )。

The view pg_prepared_xacts displays information about transactions that are currently prepared for two-phase commit (see PREPARE TRANSACTION for details).

pg_prepared_xacts 每笔已准备的事务包含一行。当事务提交或回滚时,会删除该条目。

pg_prepared_xacts contains one row per prepared transaction. An entry is removed when the transaction is committed or rolled back.

Table 54.16. pg_prepared_xacts Columns

Table 54.16. pg_prepared_xacts Columns

Column Type

Description

transaction xid

Numeric transaction identifier of the prepared transaction

gid text

Global transaction identifier that was assigned to the transaction

prepared timestamptz

Time at which the transaction was prepared for commit

owner name (references pg_authid.rolname)

Name of the user that executed the transaction

database name (references pg_database.datname)

Name of the database in which the transaction was executed

当访问 pg_prepared_xacts 视图时,将暂时锁定内部事务管理器数据结构,并复制一份以供视图显示。这意味着,该视图可以生成一组一致的结果,同时又不会长时间阻塞正常操作。不过,如果频繁访问此视图,则可能会对数据库的性能产生一定的影响。

When the pg_prepared_xacts view is accessed, the internal transaction manager data structures are momentarily locked, and a copy is made for the view to display. This ensures that the view produces a consistent set of results, while not blocking normal operations longer than necessary. Nonetheless there could be some impact on database performance if this view is frequently accessed.