diff options
author | Melanie Plageman <melanieplageman@gmail.com> | 2025-01-16 18:42:39 -0500 |
---|---|---|
committer | Melanie Plageman <melanieplageman@gmail.com> | 2025-01-16 18:42:39 -0500 |
commit | f7a8fc10ccb882249f8624b937f2c3b467d07bd6 (patch) | |
tree | 12853f752004fb0283206e30caa9cce4f970eb6c /src/include/access/heapam.h | |
parent | 7b6468cc9523d7d923487d212281af51f7f3dae2 (diff) |
Add and use BitmapHeapScanDescData struct
Move the several members of HeapScanDescData which are specific to
Bitmap Heap Scans into a new struct, BitmapHeapScanDescData, which
inherits from HeapScanDescData.
This reduces the size of the HeapScanDescData for other types of scans
and will allow us to add additional bitmap heap scan-specific members in
the future without fear of bloating the HeapScanDescData.
Reviewed-by: Tomas Vondra
Discussion: https://postgr.es/m/c736f6aa-8b35-4e20-9621-62c7c82e2168%40vondra.me
Diffstat (limited to 'src/include/access/heapam.h')
-rw-r--r-- | src/include/access/heapam.h | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 7d06dad83fc..1640d9c32f7 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -92,22 +92,30 @@ typedef struct HeapScanDescData */ ParallelBlockTableScanWorkerData *rs_parallelworkerdata; + /* these fields only used in page-at-a-time mode and for bitmap scans */ + uint32 rs_cindex; /* current tuple's index in vistuples */ + uint32 rs_ntuples; /* number of visible tuples on page */ + OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]; /* their offsets */ +} HeapScanDescData; +typedef struct HeapScanDescData *HeapScanDesc; + +typedef struct BitmapHeapScanDescData +{ + HeapScanDescData rs_heap_base; + /* * 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. + * to return. They are common to parallel and serial BitmapHeapScans */ + + /* page of VM containing info for current block */ Buffer rs_vmbuffer; int rs_empty_tuples_pending; - - /* these fields only used in page-at-a-time mode and for bitmap scans */ - uint32 rs_cindex; /* current tuple's index in vistuples */ - uint32 rs_ntuples; /* number of visible tuples on page */ - OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]; /* their offsets */ -} HeapScanDescData; -typedef struct HeapScanDescData *HeapScanDesc; +} BitmapHeapScanDescData; +typedef struct BitmapHeapScanDescData *BitmapHeapScanDesc; /* * Descriptor for fetches from heap via an index. |