|
101 | 101 | <productname>PostgreSQL</productname> query planner.</simpara>
|
102 | 102 | </listitem>
|
103 | 103 |
|
| 104 | + <listitem> |
| 105 | + <simpara>To update the visibility map, which speeds up index-only |
| 106 | + scans.</simpara> |
| 107 | + </listitem> |
| 108 | + |
104 | 109 | <listitem>
|
105 | 110 | <simpara>To protect against loss of very old data due to
|
106 | 111 | <firstterm>transaction ID wraparound</>.</simpara>
|
|
329 | 334 | </tip>
|
330 | 335 | </sect2>
|
331 | 336 |
|
| 337 | + <sect2 id="vacuum-for-visibility-map"> |
| 338 | + <title>Updating The Visibility Map</title> |
| 339 | + |
| 340 | + <para> |
| 341 | + Vacuum maintains a <link linkend="storage-vm">visibility map</> for each |
| 342 | + table to keep track of which pages contain only tuples that are known to be |
| 343 | + visible to all active transactions (and all future transactions, until the |
| 344 | + page is again modified). This has two purposes. First, vacuum |
| 345 | + itself can skip such pages on the next run, since there is nothing to |
| 346 | + clean up. |
| 347 | + </para> |
| 348 | + |
| 349 | + <para> |
| 350 | + Second, it allows <productname>PostgreSQL</productname> to answer some |
| 351 | + queries using only the index, without reference to the underlying table. |
| 352 | + Since <productname>PostgreSQL</productname> indexes don't contain tuple |
| 353 | + visibility information, a normal index scan fetches the heap tuple for each |
| 354 | + matching index entry, to check whether it should be seen by the current |
| 355 | + transaction. An <firstterm>index-only scan</>, on the other hand, checks |
| 356 | + the visibility map first. If it's known that all tuples on the page are |
| 357 | + visible, the heap fetch can be skipped. This is most noticeable on |
| 358 | + large data sets where the visibility map can prevent disk accesses. |
| 359 | + The visibility map is vastly smaller than the heap, so it can easily be |
| 360 | + cached even when the heap is very large. |
| 361 | + </para> |
| 362 | + </sect2> |
| 363 | + |
332 | 364 | <sect2 id="vacuum-for-wraparound">
|
333 | 365 | <title>Preventing Transaction ID Wraparound Failures</title>
|
334 | 366 |
|
|
0 commit comments