diff options
author | Tomas Vondra | 2024-04-06 22:24:12 +0000 |
---|---|---|
committer | Tomas Vondra | 2024-04-06 22:24:14 +0000 |
commit | 04e72ed617be354a53a076b76c6644e364ed80a3 (patch) | |
tree | eee07b6e2234b211b393d09e8f6671c3a59b5b2d /src/include/access/heapam.h | |
parent | 87c21bb9412c8ba2727dec5ebcd74d44c2232d11 (diff) |
BitmapHeapScan: Push skip_fetch optimization into table AM
Commit 7c70996ebf0949b142 introduced an optimization to allow bitmap
scans to operate like index-only scans by not fetching a block from the
heap if none of the underlying data is needed and the block is marked
all visible in the visibility map.
With the introduction of table AMs, a FIXME was added to this code
indicating that the skip_fetch logic should be pushed into the table
AM-specific code, as not all table AMs may use a visibility map in the
same way.
This commit resolves this FIXME for the current block. The layering
violation is still present in BitmapHeapScans's prefetching code, which
uses the visibility map to decide whether or not to prefetch a block.
However, this can be addressed independently.
Author: Melanie Plageman
Reviewed-by: Andres Freund, Heikki Linnakangas, Tomas Vondra, Mark Dilger
Discussion: https://postgr.es/m/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA%40mail.gmail.com
Diffstat (limited to 'src/include/access/heapam.h')
-rw-r--r-- | src/include/access/heapam.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 2765efc4e5e..750ea30852e 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -76,6 +76,16 @@ typedef struct HeapScanDescData */ ParallelBlockTableScanWorkerData *rs_parallelworkerdata; + /* + * These fields are only used for bitmap scans for the "skip fetch" + * optimization. Bitmap scans needing no fields from the heap may skip + * fetching an all visible block, instead using the number of tuples per + * block reported by the bitmap to determine how many NULL-filled tuples + * to return. + */ + Buffer rs_vmbuffer; + int rs_empty_tuples_pending; + /* these fields only used in page-at-a-time mode and for bitmap scans */ int rs_cindex; /* current tuple's index in vistuples */ int rs_ntuples; /* number of visible tuples on page */ |