From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Make table_scan_bitmap_next_block() async-friendly |
Date: | 2024-10-25 14:22:10 |
Message-ID: | E1t4LCc-002OdS-H5@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Make table_scan_bitmap_next_block() async-friendly
Move all responsibility for indicating a block is exhuasted into
table_scan_bitmap_next_tuple() and advance the main iterator in
heap-specific code. This flow control makes more sense and is a step
toward using the read stream API for bitmap heap scans.
Previously, table_scan_bitmap_next_block() returned false to indicate
table_scan_bitmap_next_tuple() should not be called for the tuples on
the page. This happened both when 1) there were no visible tuples on the
page and 2) when the block returned by the iterator was past the end of
the table. BitmapHeapNext() (generic bitmap table scan code) handled the
case when the bitmap was exhausted.
It makes more sense for table_scan_bitmap_next_tuple() to return false
when there are no visible tuples on the page and
table_scan_bitmap_next_block() to return false when the bitmap is
exhausted or there are no more blocks in the table.
As part of this new design, TBMIterateResults are no longer used as a
flow control mechanism in BitmapHeapNext(), so we removed
table_scan_bitmap_next_tuple's TBMIterateResult parameter.
Note that the prefetch iterator is still saved in the
BitmapHeapScanState node and advanced in generic bitmap table scan code.
This is because 1) it was not necessary to change the prefetch iterator
location to change the flow control in BitmapHeapNext() 2) modifying
prefetch iterator management requires several more steps better split
over multiple commits and 3) the prefetch iterator will be removed once
the read stream API is used.
Author: Melanie Plageman
Reviewed-by: Tomas Vondra, Andres Freund, Heikki Linnakangas, Mark Dilger
Discussion: https://postgr.es/m/063e4eb4-32d9-439e-a0b1-75565a9835a8%40iki.fi
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/de380a62b5dae610b3504b5036e5d5b1150cc4a4
Modified Files
--------------
src/backend/access/heap/heapam.c | 8 +-
src/backend/access/heap/heapam_handler.c | 56 +++++--
src/backend/executor/nodeBitmapHeapscan.c | 246 +++++++++++++++++-------------
src/include/access/relscan.h | 28 +++-
src/include/access/tableam.h | 64 ++++----
src/include/nodes/execnodes.h | 12 +-
6 files changed, 252 insertions(+), 162 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-10-25 16:20:01 | pgsql: Read extension script files in text not binary mode. |
Previous Message | Noah Misch | 2024-10-25 13:51:48 | pgsql: For inplace update, send nontransactional invalidations. |