# 51.77. pg\_prepared\_xacts

The view `pg_prepared_xacts` displays information about transactions that are currently prepared for two-phase commit (see [PREPARE TRANSACTION](https://www.postgresql.org/docs/13/sql-prepare-transaction.html) for details).

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

#### **Table 51.78. `pg_prepared_xacts` Columns**

| <p>Column Type</p><p>Description</p>                                                                                                                                                                                                                  |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>transaction</code> <code>xid</code></p><p>Numeric transaction identifier of the prepared transaction</p>                                                                                                                                     |
| <p><code>gid</code> <code>text</code></p><p>Global transaction identifier that was assigned to the transaction</p>                                                                                                                                    |
| <p><code>prepared</code> <code>timestamptz</code></p><p>Time at which the transaction was prepared for commit</p>                                                                                                                                     |
| <p><code>owner</code> <code>name</code> (references <a href="https://www.postgresql.org/docs/13/catalog-pg-authid.html"><code>pg\_authid</code></a>.<code>rolname</code>)</p><p>Name of the user that executed the transaction</p>                    |
| <p><code>database</code> <code>name</code> (references <a href="https://www.postgresql.org/docs/13/catalog-pg-database.html"><code>pg\_database</code></a>.<code>datname</code>)</p><p>Name of the database in which the transaction was executed</p> |

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.postgresql.tw/internals/system-catalogs/pg_prepared_xacts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
