diff options
author | Melanie Plageman <melanieplageman@gmail.com> | 2025-02-24 16:07:50 -0500 |
---|---|---|
committer | Melanie Plageman <melanieplageman@gmail.com> | 2025-02-24 16:10:13 -0500 |
commit | b8778c4cd8bc924ce5347cb1ab10dfbf34130559 (patch) | |
tree | e04294273340adff516f244bc56550644b9f5d87 /src/backend/access/heap/heapam_handler.c | |
parent | c56e8af75e081383e05cf544f372506c8da4efe7 (diff) |
Add lossy indicator to TBMIterateResult
TBMIterateResult->ntuples is -1 when the page in the bitmap is lossy.
Add an explicit lossy indicator so that we can move ntuples out of the
TBMIterateResult in a future commit.
Discussion: https://postgr.es/m/CA%2BhUKGLHbKP3jwJ6_%2BhnGi37Pw3BD5j2amjV3oSk7j-KyCnY7Q%40mail.gmail.com
Diffstat (limited to 'src/backend/access/heap/heapam_handler.c')
-rw-r--r-- | src/backend/access/heap/heapam_handler.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index c0bec014154..269d581c2ec 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -2170,7 +2170,7 @@ heapam_scan_bitmap_next_block(TableScanDesc scan, VM_ALL_VISIBLE(scan->rs_rd, tbmres->blockno, &bscan->rs_vmbuffer)) { /* can't be lossy in the skip_fetch case */ - Assert(tbmres->ntuples >= 0); + Assert(!tbmres->lossy); Assert(bscan->rs_empty_tuples_pending >= 0); bscan->rs_empty_tuples_pending += tbmres->ntuples; @@ -2207,7 +2207,7 @@ heapam_scan_bitmap_next_block(TableScanDesc scan, /* * We need two separate strategies for lossy and non-lossy cases. */ - if (tbmres->ntuples >= 0) + if (!tbmres->lossy) { /* * Bitmap is non-lossy, so we just look through the offsets listed in @@ -2268,10 +2268,10 @@ heapam_scan_bitmap_next_block(TableScanDesc scan, Assert(ntup <= MaxHeapTuplesPerPage); hscan->rs_ntuples = ntup; - if (tbmres->ntuples >= 0) - (*exact_pages)++; - else + if (tbmres->lossy) (*lossy_pages)++; + else + (*exact_pages)++; /* * Return true to indicate that a valid block was found and the bitmap is |