> 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/views/view-pg-aios.md).

# 53.2. pg\_aios \#

The `pg_aios` view lists all [Asynchronous I/O](/appendixes/glossary.md#GLOSSARY-AIO) handles that are currently in-use. An I/O handle is used to reference an I/O operation that is being prepared, executed or is in the process of completing. `pg_aios` contains one row for each I/O handle.

This view is mainly useful for developers of PostgreSQL, but may also be useful when tuning PostgreSQL.

**Table 53.2. `pg_aios` Columns**

| <p>Column Type</p><p>Description</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>pid</code> <code>int4</code></p><p>Process ID of the server process that is issuing this I/O.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| <p><code>io\_id</code> <code>int4</code></p><p>Identifier of the I/O handle. Handles are reused once the I/O completed (or if the handle is released before I/O is started). On reuse <a href="#VIEW-PG-AIOS-IO-GENERATION"><code>pg\_aios</code>.<code>io\_generation</code> </a>is incremented.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p><code>io\_generation</code> <code>int8</code></p><p>Generation of the I/O handle.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| <p><code>state</code> <code>text</code></p><p>State of the I/O handle:</p><ul><li><code>HANDED\_OUT</code>, referenced by code but not yet used</li><li><code>DEFINED</code>, information necessary for execution is known</li><li><code>STAGED</code>, ready for execution</li><li><code>SUBMITTED</code>, submitted for execution</li><li><code>COMPLETED\_IO</code>, finished, but result has not yet been processed</li><li><code>COMPLETED\_SHARED</code>, shared completion processing completed</li><li><code>COMPLETED\_LOCAL</code>, backend local completion processing completed</li></ul>                                                                                                                                                                                               |
| <p><code>operation</code> <code>text</code></p><p>Operation performed using the I/O handle:</p><ul><li><code>invalid</code>, not yet known</li><li><code>readv</code>, a vectored read</li><li><code>writev</code>, a vectored write</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p><code>off</code> <code>int8</code></p><p>Offset of the I/O operation.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| <p><code>length</code> <code>int8</code></p><p>Length of the I/O operation.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| <p><code>target</code> <code>text</code></p><p>What kind of object is the I/O targeting:</p><ul><li><code>smgr</code>, I/O on relations</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| <p><code>handle\_data\_len</code> <code>int2</code></p><p>Length of the data associated with the I/O operation. For I/O to/from <a href="/pages/bF4j7fB8e9S3QnFT6jTM#GUC-SHARED-BUFFERS">shared\_buffers</a> and <a href="/pages/bF4j7fB8e9S3QnFT6jTM#GUC-TEMP-BUFFERS">temp\_buffers</a>, this indicates the number of buffers the I/O is operating on.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| <p><code>raw\_result</code> <code>int4</code></p><p>Low-level result of the I/O operation, or NULL if the operation has not yet completed.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p><code>result</code> <code>text</code></p><p>High-level result of the I/O operation:</p><ul><li><code>UNKNOWN</code> means that the result of the operation is not yet known.</li><li><code>OK</code> means the I/O completed successfully.</li><li><code>PARTIAL</code> means that the I/O completed without error, but did not process all data. Commonly callers will need to retry and perform the remainder of the work in a separate I/O.</li><li><code>WARNING</code> means that the I/O completed without error, but that execution of the IO triggered a warning. E.g. when encountering a corrupted buffer with <a href="/pages/aRYeEFFQgIuWIGZfLXfy#GUC-ZERO-DAMAGED-PAGES">zero\_damaged\_pages</a> enabled.</li><li><code>ERROR</code> means the I/O failed with an error.</li></ul> |
| <p><code>target\_desc</code> <code>text</code></p><p>Description of what the I/O operation is targeting.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| <p><code>f\_sync</code> <code>bool</code></p><p>Flag indicating whether the I/O is executed synchronously.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p><code>f\_localmem</code> <code>bool</code></p><p>Flag indicating whether the I/O references process local memory.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| <p><code>f\_buffered</code> <code>bool</code></p><p>Flag indicating whether the I/O is buffered I/O.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

<br>

The `pg_aios` view is read-only.

By default, the `pg_aios` view can be read only by superusers or roles with privileges of the `pg_read_all_stats` role.

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/view-pg-aios.html)（英文原文，待翻譯）


---

# 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 dynamically by asking a question.

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

```
GET https://docs.postgresql.tw/internals/views/view-pg-aios.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
