バージョンごとのドキュメント一覧

73.4. 可視性マップ #

<title>Visibility Map</title>

Each heap relation has a Visibility Map (VM) to keep track of which pages contain only tuples that are known to be visible to all active transactions; it also keeps track of which pages contain only frozen tuples. It's stored alongside the main relation data in a separate relation fork, named after the filenode number of the relation, plus a <literal>_vm</literal> suffix. For example, if the filenode of a relation is 12345, the VM is stored in a file called <filename>12345_vm</filename>, in the same directory as the main relation file. Note that indexes do not have VMs. 各ヒープリレーションは、どのページがすべての実行中のトランザクションから可視であることが分かっているタプルだけを含むかを追跡する、可視性マップ(VM)を持ちます。どのページが凍結状態のタプルだけを含むのかも追跡します。 これは、リレーションのファイルノード番号に_vmという接尾辞を付与した名前の別のリレーションフォーク内に主リレーションデータと並行して格納されます。 例えばリレーションのファイルノードが12345の場合、VMは主リレーションファイルと同じディレクトリ内の12345_vmというファイル内に格納されます。 インデックスはVMを持たないことに注意してください。

The visibility map stores two bits per heap page. The first bit, if set, indicates that the page is all-visible, or in other words that the page does not contain any tuples that need to be vacuumed. This information can also be used by <link linkend="indexes-index-only-scans"><firstterm>index-only scans</firstterm></link> to answer queries using only the index tuple. The second bit, if set, means that all tuples on the page have been frozen. That means that even an anti-wraparound vacuum need not revisit the page. 可視性マップはヒープページ当たり2ビットを保持します。 最初のビットがセットされていれば、ページはすべて可視であること、すなわち、そのページにはバキュームが必要なタプルをまったく含んでいないことを示しています。 またこの情報は、インデックスタプルのみを使用して問い合わせに答えるためにインデックスオンリースキャンによっても使用されます。 2番目のビットがセットされていれば、そのページのタプルはすべて凍結状態であることを意味します。 これは、周回対策のバキュームすらそのページを再び訪れる必要はないことを意味します。

The map is conservative in the sense that we make sure that whenever a bit is set, we know the condition is true, but if a bit is not set, it might or might not be true. Visibility map bits are only set by vacuum, but are cleared by any data-modifying operations on a page. このマップは、ビットがセットされている時は常にこの条件が真であることを確実に把握できるという点で保守的ですが、ビットがセットされていない場合は、真かもしれませんし偽かもしれません。 可視性マップのビットはバキュームによってのみで設定されます。 しかしページに対する任意のデータ編集操作によってクリアされます。

The <xref linkend="pgvisibility"/> module can be used to examine the information stored in the visibility map. pg_visibilityモジュールは可視性マップに入っている情報を確かめるのに使えます。