# 68.4 可視性映射表（Visibility Map）

每個 heap 關連都有一個可見性映射表（VM，Visibility Map），用於追踪哪些頁面僅包含已知對所有活動事務可見的 tuple；它還追踪哪些頁面僅包含凍結的 tuple。 它與主要的關連資料一起儲存在一個單獨的關連分支中，以關連的 filenode 編號命名，加上 \_vm 後綴。例如，如果關連的 filenode 是 12345，則 VM 儲存在名稱為 12345\_vm 的檔案中，與主要關連檔案位於同一目錄中。請注意，索引沒有 VM。

可見性映射表將每個 heap 頁面儲存 2 個位元。第一個位元（如果為 1）表示頁面全部可見，或者換句話說，頁面不包含任何需要清理的 tuple。索引限定掃描也可以使用此訊息來索引限定掃描 tuple 來回答查詢。第二個位元（如果為 1）表示頁面上的所有 tuple 都已凍結。這意味著即使是防止交易重疊清理也不需要重新讀取頁面。

映射表是保守的，因為我們得確保無論何時設定一個位元，我們都知道條件為真，但如果沒有設定一個位元，它可能會也可能不會成立。可見性映射位元僅由 vacuum 設定，但可以透過頁面上的任何資料修改操作清除。

[pg\_visibility](/16/appendixes/additional-supplied-modules/pg_visibility.md) 模組可用於檢查可見性映射表中儲存的訊息。


---

# Agent Instructions: 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:

```
GET https://docs.postgresql.tw/16/internals/database-physical-storage/visibility-map.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
