Re: Trying out read streams in pgvector (an extension)

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Trying out read streams in pgvector (an extension)
Date: 2025-12-09 21:42:21
Message-ID: CAAKRu_ZHvQ=ZFJPzEMS-iPnN_yFmhy1YvpZMRxoDE-eRt6T4-A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 8, 2025 at 10:47 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
>
> I think it'd be better if that were the consumer's choice. I don't
> want the consumer to be required to drain the stream before resuming,
> as that'd be an unprincipled stall. For example, if new WAL arrives
> over the network then I think it should be possible for recovery's
> WAL-powered stream of heap pages to resume looking ahead even if
> recovery hasn't drained the existing stream completely.
>
> 1. read_stream_resume() as before, but with a new explicit
> read_stream_pause(): if a block number callback would like to report a
> temporary lack of information, it should return
> read_stream_pause(stream), not InvalidBlockNumber. Then after
> read_stream_resume(stream) is called, the next
> read_stream_next_buffer() enters the lookahead loop again. While
> paused, if the consumer drains all the existing buffers in the stream
> and then one more, it will receive InvalidBuffer, but if the _resume()
> call is made sooner, the consumer won't ever know about the temporary
> lack of buffers in the stream.

I like this new interface. If the user does want to exhaust the stream
(as was the case with earlier pgvector read stream user code), I
assume you would want to do:

read_stream_pause()
read_stream_reset()
read_stream_resume()

- Melanie

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2025-12-09 21:54:21 Re: Solaris versus our NLS files
Previous Message Robert Haas 2025-12-09 21:40:17 Re: Qual push down to table AM