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

# 27.4.6. 基礎備份進度回報

## 27.4.6. 基礎備份進度回報 [#](#basebackup-progress-reporting) <a href="#basebackup-progress-reporting" id="basebackup-progress-reporting"></a>

每當像 pg\_basebackup 這樣的應用程式 正在取得基礎備份時， `pg_stat_progress_basebackup` 檢視表中，就會針對每個目前正在執行 `BASE_BACKUP` 複寫命令、 並串流傳輸備份資料的 WAL 傳送程序，各含有一列。 下方的表格，說明了會被回報的資訊， 並提供如何解讀這些資訊的說明。

### 表 27.47. `pg_stat_progress_basebackup` 檢視表 [#](#pg-stat-progress-basebackup-view) <a href="#pg-stat-progress-basebackup-view" id="pg-stat-progress-basebackup-view"></a>

| <p>欄位型別</p><p>說明</p>                                                                                                                                                                                                                                                                                                                                                                         |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>pid</code> <code>integer</code></p><p>某個 WAL 傳送程序的程序 ID。</p>                                                                                                                                                                                                                                                                                                                        |
| <p><code>phase</code> <code>text</code></p><p>目前的處理階段。請參閱<a href="#basebackup-phases">表 27.48</a>。</p>                                                                                                                                                                                                                                                                                       |
| <p><code>backup\_total</code> <code>bigint</code></p><p>將被串流傳輸的資料總量。此為預估值， 在 <code>streaming database files</code> 階段開始時回報。請注意，這只是一個近似值， 因為在 <code>streaming database files</code> 階段期間，資料庫可能會發生變化， 且 WAL 日誌之後也可能會被納入備份中。 一旦已串流傳輸的資料量超過預估的總大小， 此值就會與 <code>backup\_streamed</code> 永遠保持相同。若在 pg\_basebackup 中停用了此項預估（也就是指定了 <code>--no-estimate-size</code> 選項）， 則此值為 <code>NULL</code>。</p> |
| <p><code>backup\_streamed</code> <code>bigint</code></p><p>已串流傳輸的資料量。此計數器只會在 階段為 <code>streaming database files</code> 或 <code>transferring wal files</code> 時才會前進。</p>                                                                                                                                                                                                                      |
| <p><code>tablespaces\_total</code> <code>bigint</code></p><p>將被串流傳輸的資料表空間總數。</p>                                                                                                                                                                                                                                                                                                             |
| <p><code>tablespaces\_streamed</code> <code>bigint</code></p><p>已串流傳輸的資料表空間數。此計數器只會在 階段為 <code>streaming database files</code> 時才會前進。</p>                                                                                                                                                                                                                                                    |

<br>

### 表 27.48. 基礎備份各階段 [#](#basebackup-phases) <a href="#basebackup-phases" id="basebackup-phases"></a>

| 階段                                    | 說明                                                                                                                                                               |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `initializing`                        | 此 WAL 傳送程序正在準備開始備份。 預期此階段耗時應非常短暫。                                                                                                                                |
| `waiting for checkpoint to finish`    | 此 WAL 傳送程序目前正在執行 `pg_backup_start`， 以準備取得基礎備份， 並正在等待備份開始檢查點完成。                                                                                                   |
| `estimating backup size`              | 此 WAL 傳送程序目前正在預估， 將以基礎備份形式串流傳輸之資料庫檔案的總量。                                                                                                                         |
| `streaming database files`            | 此 WAL 傳送程序目前正在以基礎備份形式， 串流傳輸資料庫檔案。                                                                                                                                |
| `waiting for wal archiving to finish` | 此 WAL 傳送程序目前正在執行 `pg_backup_stop` 以完成此次備份， 並正在等待此次基礎備份所需的所有 WAL 檔案， 都成功歸檔完成。 若在 pg\_basebackup 中指定了 `--wal-method=none` 或 `--wal-method=stream`， 則此階段完成後，備份就會結束。 |
| `transferring wal files`              | 此 WAL 傳送程序目前正在傳輸備份期間 所產生的所有 WAL 日誌。此階段會在 `waiting for wal archiving to finish` 階段之後發生，前提是在 pg\_basebackup 中指定了 `--wal-method=fetch`。 此階段完成後，備份就會結束。              |

<br>

[返回 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/basebackup-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.
