Re: BitmapHeapScan streaming read user and prelim refactoring

Jakub Wartak <jakub.wartak@enterprisedb.com>

From: Jakub Wartak <jakub.wartak@enterprisedb.com>
To: Melanie Plageman <melanieplageman@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, Thomas Munro <thomas.munro@gmail.com>, Tomas Vondra <tomas@vondra.me>, Nazir Bilal Yavuz <byavuz81@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>, Heikki Linnakangas <hlinnaka@iki.fi>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2025-03-18T10:51:47Z
Lists: pgsql-hackers
On Mon, Mar 17, 2025 at 10:46 PM Melanie Plageman
<melanieplageman@gmail.com> wrote:
>
> On Mon, Mar 17, 2025 at 2:55 PM Andres Freund <andres@anarazel.de> wrote:
> >
> > On 2025-03-17 14:52:02 -0400, Melanie Plageman wrote:
> > > I don't feel strongly that we need to be as rigorous for
> > > maintenance_io_concurrency, but I'm also not sure 160 seems reasonable
> > > (which would be the same ratio as before).
> >
> > I'd lean towards just setting them to the same value for now.
>
> Cool, here's the patch I intend to commit. I had a bit of trouble
> clearly explaining the situation in the commit message which is why I
> didn't directly commit it. If no one  has ideas on how to clarify it
> by tomorrow, I'll just push it.

Hi Melanie, same (160 is probably way too high for default m_io_c on
default/small systems with s_b=128MB, but the same value is probably
fine), so +1.

One may say that higher m_io_c may hurt , but at least for
startup/recovery performance see image [1] (from thread [2]) - it
shows running it on NVMe  with m_io_c=128 and being faster than
default =10 and later Tomas V. pushed it even into value of "500" [3].
Hope that helps.

-J.

[1] https://www.postgresql.org/message-id/attachment/116928/trandomuuids-without-FPW-1.5kTPS_lagOverSize.csv-comments.png
[2] https://www.postgresql.org/message-id/VI1PR0701MB69608CBCE44D80857E59572EF6CA0%40VI1PR0701MB6960.eurprd07.prod.outlook.com
[3] https://www.postgresql.org/message-id/c5d52837-6256-0556-ac8c-d6d3d558820a%40enterprisedb.com



Commits

  1. Fix bitmapheapscan incorrect recheck of NULL tuples

  2. Increase default maintenance_io_concurrency to 16

  3. Separate TBM[Shared|Private]Iterator and TBMIterateResult

  4. Improve read_stream.c advice for dense streams.

  5. Increase default effective_io_concurrency to 16

  6. Delay extraction of TIDBitmap per page offsets

  7. Add lossy indicator to TBMIterateResult

  8. Move BitmapTableScan per-scan setup into a helper

  9. Add and use BitmapHeapScanDescData struct

  10. Fix bitmap table scan crash on iterator release

  11. Bitmap Table Scans use unified TBMIterator

  12. Add common interface for TBMIterators

  13. Make table_scan_bitmap_next_block() async-friendly

  14. Move EXPLAIN counter increment to heapam_scan_bitmap_next_block

  15. Refactor tidstore.c iterator buffering.

  16. BitmapHeapScan: Remove incorrect assert and reset field

  17. Change BitmapAdjustPrefetchIterator to accept BlockNumber

  18. BitmapHeapScan: Use correct recheck flag for skip_fetch

  19. BitmapHeapScan: Push skip_fetch optimization into table AM

  20. BitmapHeapScan: postpone setting can_skip_fetch

  21. BitmapHeapScan: begin scan after bitmap creation

  22. Fix EXPLAIN Bitmap heap scan to count pages with no visible tuples

  23. Remove redundant snapshot copying from parallel leader to workers

  24. Remove some obsolete smgrcloseall() calls.

  25. Remove the "snapshot too old" feature.

  26. Compute XID horizon for page level index vacuum on primary.