Re: index prefetching - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: index prefetching
Date
Msg-id CA+hUKG+9yP4JC_PXdrew7-xQPVy2VGucFjnDveJRsQibPVOyVg@mail.gmail.com
Whole thread Raw
In response to Re: index prefetching  (Nazir Bilal Yavuz <byavuz81@gmail.com>)
Responses Re: index prefetching
List pgsql-hackers
On Tue, Aug 12, 2025 at 11:22 PM Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
> Unfortunately this doesn't work. We need to handle backwards I/O
> combining in the StartReadBuffersImpl() function too as buffer indexes
> won't have correct blocknums. Also, I think buffer forwarding of split
> backwards I/O should be handled in a couple of places.

Perhaps there could be a flag pending_read_backwards that can only
become set with pending_read_nblocks goes from 1 to 2, and then a new
flag stream->ios[x].backwards (in struct InProgressIO) that is set in
read_stream_start_pending_read().  Then immediately after
WaitReadBuffers(), we reverse the buffers it returned in place if that
flag was set.  Oh, I see, you were imagining a flag
READ_BUFFERS_REVERSE that tells WaitReadBuffers() to do that
internally.  Hmm.  Either way I don't think you need to consider the
forwarded buffers because they will be reversed during a later call
that includes them in *nblocks (output value), no?



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Update LDAP Protocol in fe-connect.c to v3
Next
From: Peter Geoghegan
Date:
Subject: Re: index prefetching