Re: BUG: ReadStream look-ahead exhausts local buffers when effective_io_concurrency>=64

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Cc: Induja Sreekanthan <indujas(at)google(dot)com>, pgsql-hackers(at)postgresql(dot)org, Andres Freund <andres(at)anarazel(dot)de>, Simhachala Sasikanth Gottapu <simhachala(at)google(dot)com>, Vishal Bagga <vishalbagga(at)google(dot)com>, Madhukar <madhukarprasad(at)google(dot)com>, Shihao Zhong <shihaozhong(at)google(dot)com>, Yi Ding <yidin(at)google(dot)com>, Hardik Singh Negi <hardiksnegi(at)google(dot)com>
Subject: Re: BUG: ReadStream look-ahead exhausts local buffers when effective_io_concurrency>=64
Date: 2026-08-05 15:52:39
Message-ID: CAAKRu_ZBT2itv0Jtid8QZqwM5JqL2E=hFrxqg4hdVYmrDVWC8Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 24, 2026 at 1:40 AM Xuneng Zhou <xunengzhou(at)gmail(dot)com> wrote:
>
> On Thu, Jul 23, 2026 at 11:08 PM Melanie Plageman
> <melanieplageman(at)gmail(dot)com> wrote:
> >
>
> > I wonder if in 20, we should move toward Andres' suggested formula
> > Max(1, (num_temp_buffers − NLocalPinnedBuffers) / 4)
> > instead of the existing
> > num_temp_buffers / 4 − NLocalPinnedBuffers
> >
> > Which would mean we got a quarter of available buffers instead of a
> > hard cap of a quarter of total buffers.
> > This wouldn't have been any better at solving the issue in this
> > thread, but I'm wondering if it is just a better formula in general
> > going forward (not for backpatching).
>
> I am not sure about that. In the existing formula, we set a hard-cap
> for the read streams at backend level. For the suggested one, the cap
> is removed so multiple successive streams could push the water level
> of pins toward the ceiling of temp buffers. I am unsure of the
> consequences of this. Adjusting the cap limit alone seems not resolve
> the competing nature between read stream and other needs. Reclaiming
> some pinned buffers might help, but it is a more complex mechanism
> which might not be a good fit in the bigger picture.

I think the right approach is to drive out a change like this with
specific use cases or after seeing bottlenecks/problems in workloads.
Since we're not encountering those now, I think investigating how to
change this falls far down the priority list.

- Melanie

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-08-05 16:02:27 Re: Restructured Shared Buffer Hash Table
Previous Message Melanie Plageman 2026-08-05 15:50:53 Re: BUG: ReadStream look-ahead exhausts local buffers when effective_io_concurrency>=64