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

# 68.5. 啟動初始化 BKI 檔案的結構

### 68.5. 啟動初始化 BKI 檔案的結構 [#](#bki-structure) <a href="#bki-structure" id="bki-structure"></a>

只有在 `open` 命令所需的資料表已存在，且其中包含要開啟之資料表的項目時，才能使用 `open`。（最少需要的資料表是 `pg_class`、`pg_attribute`、`pg_proc` 與 `pg_type`。）為了填入這些資料表本身，帶有 `bootstrap` 選項的 `create` 會隱含地開啟剛建立的資料表，以供插入資料。

同樣地，只有在所需的系統目錄已建立並填入資料後，才能使用 `declare index` 與 `declare toast` 命令。

因此，`postgres.bki` 檔案必須採用下列結構：

1. 使用 `create bootstrap` 建立其中一個關鍵資料表。
2. 使用 `insert` 插入至少描述這些關鍵資料表的資料。
3. 執行 `close`。
4. 對其他關鍵資料表重複上述步驟。
5. 使用 `create`（不加 `bootstrap`）建立非關鍵資料表。
6. 執行 `open`。
7. 使用 `insert` 插入所需資料。
8. 執行 `close`。
9. 對其他非關鍵資料表重複上述步驟。
10. 定義索引與 TOAST 資料表。
11. 執行 `build indices`。

無疑還存在其他尚未記載的順序相依關係。

***

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


---

# 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/bki/bki-structure.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.
