> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/internals/system-catalogs/pg_prepared_xacts.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
