57.18. pg_prepared_xacts #

Представление pg_prepared_xacts содержит информацию о транзакциях, которые в настоящее время подготовлены для двухфазной фиксации (за подробностями обратитесь к PREPARE TRANSACTION).

Представление pg_prepared_xacts содержит отдельную запись для каждой подготовленной транзакции. Эта запись удаляется, когда транзакция фиксируется или откатывается.

Таблица 57.18. Столбцы pg_prepared_xacts

Тип столбца

Описание

transaction xid

Числовой идентификатор подготовленной транзакции

gid text

Глобальный идентификатор транзакции, назначаемый транзакции

prepared timestamptz

Время, в которое транзакция была подготовлена для фиксации

owner name (ссылается на pg_authid.rolname)

Имя пользователя, выполнявшего транзакцию

database name (ссылается на pg_database.datname)

Имя базы данных, в которой выполнялась транзакция

state3pc text

Состояние трёхфазной фиксации (используется только расширением multimaster)


Когда запрашивается представление pg_prepared_xacts, внутренние структуры данных менеджера транзакций на мгновение блокируются и создаётся их копия для вывода через это представление. Это гарантирует, что представление выдаёт согласованный набор результатов, при этом не задерживая обычные операции на более продолжительное время, чем необходимо. Тем не менее это может отрицательно сказаться на производительности базы данных при частых обращениях к представлению.

57.18. pg_prepared_xacts #

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 contains one row per prepared transaction. An entry is removed when the transaction is committed or rolled back.

Table 57.18. 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

state3pc text

State of the three-phase commit (used only by multimaster)


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.

FAQ