diff options
author | Melanie Plageman <melanieplageman@gmail.com> | 2024-10-25 10:11:46 -0400 |
---|---|---|
committer | Melanie Plageman <melanieplageman@gmail.com> | 2024-10-25 10:11:46 -0400 |
commit | 7bd7aa4d30676de006636bb2c9c079c363d9d56c (patch) | |
tree | 1c3ce84957f5130368d7220d4b81bfbeec2cc164 /src/backend/access/heap/heapam_handler.c | |
parent | 8e7e672cdaa6bfec85d4d5dd9be84159df23bb41 (diff) | |
download | postgresql-7bd7aa4d30676de006636bb2c9c079c363d9d56c.tar.gz postgresql-7bd7aa4d30676de006636bb2c9c079c363d9d56c.zip |
Move EXPLAIN counter increment to heapam_scan_bitmap_next_block
Increment the lossy and exact page counters for EXPLAIN of bitmap heap
scans in heapam_scan_bitmap_next_block(). Note that other table AMs will
need to do this as well
Pushing the counters into heapam_scan_bitmap_next_block() is required to
be able to use the read stream API for bitmap heap scans. The bitmap
iterator must be advanced from inside the read stream callback, so
TBMIterateResults cannot be used as a flow control mechanism in
BitmapHeapNext().
Author: Melanie Plageman
Reviewed-by: Tomas Vondra, Heikki Linnakangas
Discussion: https://postgr.es/m/063e4eb4-32d9-439e-a0b1-75565a9835a8%40iki.fi
Diffstat (limited to 'src/backend/access/heap/heapam_handler.c')
-rw-r--r-- | src/backend/access/heap/heapam_handler.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index 8c59b77b64f..166aab7a93c 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -2115,7 +2115,8 @@ heapam_estimate_rel_size(Relation rel, int32 *attr_widths, static bool heapam_scan_bitmap_next_block(TableScanDesc scan, - TBMIterateResult *tbmres) + TBMIterateResult *tbmres, + uint64 *lossy_pages, uint64 *exact_pages) { HeapScanDesc hscan = (HeapScanDesc) scan; BlockNumber block = tbmres->blockno; @@ -2243,6 +2244,11 @@ heapam_scan_bitmap_next_block(TableScanDesc scan, Assert(ntup <= MaxHeapTuplesPerPage); hscan->rs_ntuples = ntup; + if (tbmres->ntuples >= 0) + (*exact_pages)++; + else + (*lossy_pages)++; + return ntup > 0; } |