Introduce visibility map. The visibility map is a bitmap with one bit per
authorHeikki Linnakangas <[email protected]>
Wed, 3 Dec 2008 13:05:22 +0000 (13:05 +0000)
committerHeikki Linnakangas <[email protected]>
Wed, 3 Dec 2008 13:05:22 +0000 (13:05 +0000)
commit41af217c184e047b54dc70cfdd5531b4557b6f3e
tree5e7a52138671fdefe147ec91f47b269cc5aee645
parenta1acbf39084cda4905a19a29f007a818fe497d23
Introduce visibility map. The visibility map is a bitmap with one bit per
heap page, where a set bit indicates that all tuples on the page are
visible to all transactions, and the page therefore doesn't need
vacuuming. It is stored in a new relation fork.

Lazy vacuum uses the visibility map to skip pages that don't need
vacuuming. Vacuum is also responsible for setting the bits in the map.
In the future, this can hopefully be used to implement index-only-scans,
but we can't currently guarantee that the visibility map is always 100%
up-to-date.

In addition to the visibility map, there's a new PD_ALL_VISIBLE flag on
each heap page, also indicating that all tuples on the page are visible to
all transactions. It's important that this flag is kept up-to-date. It
is also used to skip visibility tests in sequential scans, which gives a
small performance gain on seqscans.
14 files changed:
src/backend/access/heap/Makefile
src/backend/access/heap/heapam.c
src/backend/access/heap/visibilitymap.c [new file with mode: 0644]
src/backend/access/transam/xlogutils.c
src/backend/catalog/catalog.c
src/backend/catalog/storage.c
src/backend/commands/vacuum.c
src/backend/commands/vacuumlazy.c
src/backend/utils/cache/relcache.c
src/include/access/htup.h
src/include/access/visibilitymap.h [new file with mode: 0644]
src/include/storage/bufpage.h
src/include/storage/relfilenode.h
src/include/utils/rel.h