> 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/19/internals/views/view-pg-aios.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# 53.2. pg\_aios \#

### 53.2. `pg_aios` [#](#view-pg-aios) <a href="#view-pg-aios" id="view-pg-aios"></a>

檢視表 `pg_aios` 列出目前使用中的所有[非同步 I/O](https://docs.postgresql.tw/19/appendixes/glossary.md#glossary-aio) 控制代碼。I/O 控制代碼用來參照一個正在準備、正在執行或正在完成中的 I/O 操作。`pg_aios` 中，每個 I/O 控制代碼各占一筆資料列。

此檢視表主要對 PostgreSQL 的開發者有用，但在調校 PostgreSQL 時也可能有幫助。

#### 表 53.2. `pg_aios` 欄位 [#](#view-pg-aios-columns) <a href="#view-pg-aios-columns" id="view-pg-aios-columns"></a>

| <p>欄位類型</p><p>說明</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p><code>pid</code> <code>int4</code></p><p>發出此 I/O 之伺服器程序的程序 ID。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| <p><code>io\_id</code> <code>int4</code></p><p>I/O 控制代碼的識別碼。I/O 完成後（或控制代碼在 I/O 開始之前就被釋放時），控制代碼會被重複使用。重複使用時， <a href="#VIEW-PG-AIOS-IO-GENERATION"><code>pg\_aios</code>.<code>io\_generation</code> </a>會遞增。</p>                                                                                                                                                                                                                                                                                                               |
| <p><code>io\_generation</code> <code>int8</code></p><p>I/O 控制代碼的世代。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| <p><code>state</code> <code>text</code></p><p>I/O 控制代碼的狀態：</p><ul><li><code>HANDED\_OUT</code>：已被程式碼參照，但尚未使用</li><li><code>DEFINED</code>：已知執行所需的資訊</li><li><code>STAGED</code>：已準備好執行</li><li><code>SUBMITTED</code>：已送出執行</li><li><code>COMPLETED\_IO</code>：已完成，但結果尚未處理</li><li><code>COMPLETED\_SHARED</code>：共享的完成處理已完成</li><li><code>COMPLETED\_LOCAL</code>：後端本地的完成處理已完成</li></ul>                                                                                                                                      |
| <p><code>operation</code> <code>text</code></p><p>使用此 I/O 控制代碼執行的操作：</p><ul><li><code>invalid</code>：尚未得知</li><li><code>readv</code>：向量化讀取</li><li><code>writev</code>：向量化寫入</li></ul>                                                                                                                                                                                                                                                                                                                                         |
| <p><code>off</code> <code>int8</code></p><p>I/O 操作的位移量。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| <p><code>length</code> <code>int8</code></p><p>I/O 操作的長度。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| <p><code>target</code> <code>text</code></p><p>此 I/O 所針對的物件種類：</p><ul><li><code>smgr</code>：對關聯進行的 I/O</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p><code>handle\_data\_len</code> <code>int2</code></p><p>與此 I/O 操作相關聯的資料長度。對於寫入或讀取 <a href="https://docs.postgresql.tw/19/server-administration/runtime-config/runtime-config-resource.md#GUC-SHARED-BUFFERS">shared\_buffers</a> 與 <a href="https://docs.postgresql.tw/19/server-administration/runtime-config/runtime-config-resource.md#GUC-TEMP-BUFFERS">temp\_buffers</a> 的 I/O，此值表示該 I/O 所操作的緩衝區數量。</p>                                                                                                                 |
| <p><code>raw\_result</code> <code>int4</code></p><p>I/O 操作的低階結果；若操作尚未完成則為 NULL。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| <p><code>result</code> <code>text</code></p><p>I/O 操作的高階結果：</p><ul><li><code>UNKNOWN</code> 表示尚未得知操作的結果。</li><li><code>OK</code> 表示 I/O 已成功完成。</li><li><code>PARTIAL</code> 表示 I/O 已無錯誤地完成，但並未處理所有資料。呼叫端通常需要重試，並以另一個 I/O 執行剩餘的工作。</li><li><code>WARNING</code> 表示 I/O 已無錯誤地完成，但執行該 IO 時觸發了警告。例如在啟用 <a href="https://docs.postgresql.tw/19/server-administration/runtime-config/runtime-config-developer.md#GUC-ZERO-DAMAGED-PAGES">zero\_damaged\_pages</a> 的情況下遇到損毀的緩衝區時。</li><li><code>ERROR</code> 表示 I/O 因錯誤而失敗。</li></ul> |
| <p><code>target\_desc</code> <code>text</code></p><p>此 I/O 操作所針對對象的描述。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| <p><code>f\_sync</code> <code>bool</code></p><p>表示此 I/O 是否以同步方式執行的旗標。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p><code>f\_localmem</code> <code>bool</code></p><p>表示此 I/O 是否參照程序本地記憶體的旗標。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <p><code>f\_buffered</code> <code>bool</code></p><p>表示此 I/O 是否為經過緩衝的 I/O 的旗標。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                              |

<br>

`pg_aios` 檢視表是唯讀的。

預設情況下，只有超級使用者或具有 `pg_read_all_stats` 角色權限的角色可以讀取 `pg_aios` 檢視表。

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/view-pg-aios.html)（原文版本：18.6；核對日期：2026-10-12）


---

# 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/19/internals/views/view-pg-aios.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.
