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.
}
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,