Question about read_stream_look_ahead()

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Question about read_stream_look_ahead()
Date: 2024-11-27 05:41:32
Message-ID: CAFiTN-uxyf7qOkOStDbu_WZFOFCXOGkjqNeOiH+V9D1EBHkhyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I was looking into this function, especially this block of code[1], so
what I have noticed is that we always try to combine the sequential
block when the lookahead blocknum is higher than the
pending_read_blocknum, that's fine for ForwardScan. My question is
should we do something for backward scanning as well? I mean if we
haven't yet started the I/O then shouldn't we try to merge blocknum
which are smaller than pending_read_blocknum which would be the
normal case in backward scan. I mean we would need to change the
start block number in this case though.

[1]
/* Can we merge it with the pending read? */
if (stream->pending_read_nblocks > 0 &&
stream->pending_read_blocknum + stream->pending_read_nblocks == blocknum)
{
stream->pending_read_nblocks++;
continue;
}

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2024-11-27 06:01:30 Re: Skip collecting decoded changes of already-aborted transactions
Previous Message Corey Huinker 2024-11-27 05:08:26 Re: Statistics Import and Export