From: Melanie Plageman Date: Thu, 3 Apr 2025 22:23:02 +0000 (-0400) Subject: Use AIO batchmode for bitmap heap scans X-Git-Tag: REL_18_BETA1~295 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=67be093562b6b345c170417312dff22f467055ba;p=postgresql.git Use AIO batchmode for bitmap heap scans Previously bitmap heap scan was not AIO batchmode safe because of the visibility map reads potentially done for the "skip fetch" optimization (which skipped fetching tuples from the heap if the pages were all visible and none of the columns were used in the query). The skip fetch optimization implementation was found to have bugs and was removed in 459e7bf8e2f8, so we can safely enable batchmode for bitmap heap scans. --- diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 5b3fe4a1d3b..ed2e3021799 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -1204,13 +1204,8 @@ heap_beginscan(Relation relation, Snapshot snapshot, } else if (scan->rs_base.rs_flags & SO_TYPE_BITMAPSCAN) { - /* - * Currently we can't trivially use batching, due to the - * VM_ALL_VISIBLE check in bitmapheap_stream_read_next. While that - * could be made safe, we are about to remove the all-visible logic - * from bitmap scans due to its unsoundness. - */ - scan->rs_read_stream = read_stream_begin_relation(READ_STREAM_DEFAULT, + scan->rs_read_stream = read_stream_begin_relation(READ_STREAM_DEFAULT | + READ_STREAM_USE_BATCHING, scan->rs_strategy, scan->rs_base.rs_rd, MAIN_FORKNUM,