Hi, On 2024-04-10 16:50:44 -0400, Melanie Plageman wrote: > This brings up a question about the prefetching. We never had to have > this discussion for sequential scan streaming read because it didn't > (and still doesn't) do prefetching. But, if we push the streaming read > code down into the heap AM layer, it will be doing the prefetching. > So, do we remove the prefetching from acquire_sample_rows() and expect > other table AMs to implement it themselves or use the streaming read > API?
The prefetching added to acquire_sample_rows was quite narrowly tailored to something heap-like - it pretty much required that block numbers to be 1:1 with the actual physical on-disk location for the specific AM. So I think it's pretty much required for this to be pushed down. Using a read stream is a few lines for something like this, so I'm not worried about it. I guess we could have a default implementation for block based AMs, similar what we have around table_block_parallelscan_*, but not sure it's worth doing that, the complexity is much lower than in the table_block_parallelscan_ case. Greetings, Andres