> 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/server-administration/monitoring/progress-reporting/analyze-progress-reporting.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# 27.4.1. ANALYZE 進度回報

## 27.4.1. ANALYZE 進度回報 [#](#analyze-progress-reporting) <a href="#analyze-progress-reporting" id="analyze-progress-reporting"></a>

每當 `ANALYZE` 正在執行時， `pg_stat_progress_analyze` 檢視表中， 就會針對每個目前正在執行此命令的後端，各含有一列。 下方的表格，說明了會被回報的資訊， 並提供如何解讀這些資訊的說明。

### 表 27.38. `pg_stat_progress_analyze` 檢視表 [#](#pg-stat-progress-analyze-view) <a href="#pg-stat-progress-analyze-view" id="pg-stat-progress-analyze-view"></a>

| <p>欄位型別</p><p>說明</p>                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>pid</code> <code>integer</code></p><p>後端程序的 ID。</p>                                                                                                                                                                                                                                                                                                                                                                                    |
| <p><code>datid</code> <code>oid</code></p><p>此後端所連線之資料庫的 OID。</p>                                                                                                                                                                                                                                                                                                                                                                               |
| <p><code>datname</code> <code>name</code></p><p>此後端所連線之資料庫的名稱。</p>                                                                                                                                                                                                                                                                                                                                                                              |
| <p><code>relid</code> <code>oid</code></p><p>正在被分析之資料表的 OID。</p>                                                                                                                                                                                                                                                                                                                                                                                |
| <p><code>phase</code> <code>text</code></p><p>目前的處理階段。請參閱<a href="#analyze-phases">表 27.39</a>。</p>                                                                                                                                                                                                                                                                                                                                             |
| <p><code>sample\_blks\_total</code> <code>bigint</code></p><p>將被取樣的堆積區塊總數。</p>                                                                                                                                                                                                                                                                                                                                                                  |
| <p><code>sample\_blks\_scanned</code> <code>bigint</code></p><p>已掃描的堆積區塊數。</p>                                                                                                                                                                                                                                                                                                                                                                  |
| <p><code>ext\_stats\_total</code> <code>bigint</code></p><p>延伸統計資訊的數量。</p>                                                                                                                                                                                                                                                                                                                                                                      |
| <p><code>ext\_stats\_computed</code> <code>bigint</code></p><p>已計算完成的延伸統計資訊數量。此計數器只會在 階段為 <code>computing extended statistics</code> 時才會前進。</p>                                                                                                                                                                                                                                                                                                 |
| <p><code>child\_tables\_total</code> <code>bigint</code></p><p>子資料表的數量。</p>                                                                                                                                                                                                                                                                                                                                                                     |
| <p><code>child\_tables\_done</code> <code>bigint</code></p><p>已掃描的子資料表數量。此計數器只會在 階段為 <code>acquiring inherited sample rows</code> 時才會前進。</p>                                                                                                                                                                                                                                                                                                    |
| <p><code>current\_child\_table\_relid</code> <code>oid</code></p><p>目前正在被掃描之子資料表的 OID。只有在 階段為 <code>acquiring inherited sample rows</code> 時，此欄位才有效。</p>                                                                                                                                                                                                                                                                                        |
| <p><code>delay\_time</code> <code>double precision</code></p><p>因基於成本的延遲（請參閱 <a href="https://docs.postgresql.tw/19/server-administration/runtime-config/runtime-config-vacuum.md#runtime-config-resource-vacuum-cost">19.10.2 節</a>） 而耗費在休眠上的總時間，以毫秒為單位 （若已啟用 <a href="https://docs.postgresql.tw/19/server-administration/runtime-config/runtime-config-statistics.md#GUC-TRACK-COST-DELAY-TIMING">track\_cost\_delay\_timing</a>， 否則為零）。</p> |

<br>

### 表 27.39. ANALYZE 各階段 [#](#analyze-phases) <a href="#analyze-phases" id="analyze-phases"></a>

| 階段                                | 說明                                                                                                               |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `initializing`                    | 此命令正在準備開始掃描堆積。預期此階段 耗時應非常短暫。                                                                                     |
| `acquiring sample rows`           | 此命令目前正在掃描 `relid` 所指定的資料表， 以取得取樣資料列。                                                                             |
| `acquiring inherited sample rows` | 此命令目前正在掃描子資料表， 以取得取樣資料列。欄位 `child_tables_total`、 `child_tables_done`，以及 `current_child_table_relid`， 含有此階段的進度資訊。 |
| `computing statistics`            | 此命令正在根據資料表掃描期間取得的取樣資料列， 計算統計資訊。                                                                                  |
| `computing extended statistics`   | 此命令正在根據資料表掃描期間取得的取樣資料列， 計算延伸統計資訊。                                                                                |
| `finalizing analyze`              | 此命令正在更新 `pg_class`。 此階段完成後，`ANALYZE` 就會結束。                                                                       |

<br>

### 注意

請注意，當你對某個分割資料表執行 `ANALYZE`， 且未加上 `ONLY` 關鍵字時， 其所有的分割區也都會被遞迴分析。在此情況下， `ANALYZE` 進度會先針對父資料表回報 （此時會蒐集其繼承統計資訊）， 接著才是各個分割區的進度。

[返回 27.4. 進度回報](https://docs.postgresql.tw/19/server-administration/monitoring/progress-reporting.md#progress-reporting)

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/progress-reporting.html)（原文版本：18.6；核對日期：2026-09-26）


---

# 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/server-administration/monitoring/progress-reporting/analyze-progress-reporting.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.
