Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIxek-004ttN-2R for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 23:20:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vIxei-008GSh-1f for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 23:20:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIxei-008GSZ-0j for pgsql-hackers@lists.postgresql.org; Tue, 11 Nov 2025 23:20:08 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vIxeg-007EeC-0K for pgsql-hackers@postgresql.org; Tue, 11 Nov 2025 23:20:07 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-29806bd4776so246375ad.0 for ; Tue, 11 Nov 2025 15:20:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762903204; x=1763508004; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=d12rSeJkMlacr8GNkwh8a3vWYYi7eHuGd7p7iwT1yho=; b=kn7QyENXTr1peXLPrY5AaFCkpR9YIwNS0dUDTREeeDDczwaQheVgz5pS1Do39R1p1D o0UJddTFVTKQtQzmXQ2mh7Bpnk4WUv33eQv6JH1hXdFblvuMhfkyV8wOwgJ7bSKH/aM9 UwkF5Yy7gyowW0UURPEK7ttx/rNDuVlfGfuB0TSinW6BxLZn1LeL/1ouc0iUeTXY0T+F qoaec3Y4yBtpL9HQneoV6UJamurUQO237Yoj/o3JRouhkYOWlGXA98JbHN775yD5O9+W XqufUrL/tC5u1D+h5QzpIGltWcn4t7OZ/j1RJF1po2UVFJxd0Hg6LSZR2+sVFaXB42jq rd/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762903204; x=1763508004; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=d12rSeJkMlacr8GNkwh8a3vWYYi7eHuGd7p7iwT1yho=; b=d1cR+D9KNTRvsVPONCalZzE9UfNg0UhbMLc1y3Y0Lp7wTPBbk8ukCzp5qX1eTJ8Eq3 6TF9jwZAKERSU1E5Q5BpmmSpedMhvePxdlAt4rOXhhb7jRogwvjVDgHE/m3qU39zBI6O iBtLP/60ho1Q2ZI8X9J26Gq8fzMbAQot8LYSgi5hO8nW71EEO0cIOk2+Fn1XVmJFnyJn dBJJGenbxPuFpA6HTZ7qFVcgs+6SwW455Yyjr5UtISnF6K3cbz7p1jSwK0Pfa//7TpzI y2as5ix1rslcFszTRFFVTFq4KYFY1WCrARWVk6cAx1uMzITggkkWJPNCvqHHu3TeJnye 7JpA== X-Forwarded-Encrypted: i=1; AJvYcCV86MCunlPOphgkMdafFkPa/9mxSltuqADEkgc7Fsg2zXJqe3mGSKJZbZNcTrJtMpiODqeesxO2FrsDE6Qn@postgresql.org X-Gm-Message-State: AOJu0YxU2Bc2WZpnPLs6I2NzOfAg16Oi6JCBFmFS8Lz46sPFrdClxaPa QcbWIRc00ys+DxU8DEZJYVZB+GU7lxDqA12Eepmg/rU3v5VSsvaVJKz2vbIytPsB2iRi4YgvPcq LZg13UAnRQL9sGjZQEDwA/2qhca7UrF8= X-Gm-Gg: ASbGncs8h4xJR/PSGwDzM5YehGJQL9E2KMybi4L2THBuIj3hv9wxO6+F9sfN0sB1i0b Vj9uWkYsDzpnFxLVOTrC4oV/LK4utt3SjzGroiOUCWyeLYgalCgf6PDYyan5Z7n/PKkUjqoT5+I xYGt8rtI5qJsvCrZ1y2pp7dE3zBkZtH7sYMleGUhnLISRBHumf5F+/QVHrxBF7PebhxfanO4xN4 Yv/cSfw7EZmHnNsoA0tFO1OzTgJAYyvAdan5NWA7mzZ7n2K6zVIwBCjCC+ITgD5iZ0HBIW37xxd 5Yaes/KIgvFiqrqL7XqiXJxo+qSvg1S0IgZLhRmcmQ== X-Google-Smtp-Source: AGHT+IGlNNMee+Rb/N/Q3+y9FkAT/2ASpNaY8B+PDQ45kmQSXiZXbJ8z6poK4RXQzlGsXbkfjMpnULDHaen5/6I847E= X-Received: by 2002:a17:903:41d1:b0:290:ad79:c617 with SMTP id d9443c01a7336-2984ed34d75mr7318685ad.1.1762903203470; Tue, 11 Nov 2025 15:20:03 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Thomas Munro Date: Wed, 12 Nov 2025 12:19:26 +1300 X-Gm-Features: AWmQ_bk6ZLQ8k1rKMhBmcj_ZLC2omdzIcD3tcZ5-F_-nBaMsQmxAw-93sLVkyhA Message-ID: Subject: Re: Trying out read streams in pgvector (an extension) To: Melanie Plageman Cc: "Jonathan S. Katz" , pgsql-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Nov 12, 2025 at 11:52=E2=80=AFAM Melanie Plageman wrote: > On Tue, Nov 11, 2025 at 4:22=E2=80=AFPM Thomas Munro wrote: > > But for now, to fix pgvector's woes, I wonder if it might make sense > > to call this a bug in v18, and back-patch the tiniest possible change. > > Something like what I posted[2] in this thread almost two years ago. > > I don't think it really affects any core code: we use > > read_stream_reset() only in very minimal ways there (I could > > elaborate), and it's quite arguable that the existing policy is wrong > > for them too, but we'd need to confirm that and perhaps think about > > other extensions that might be using it. > > If we are worried about regressing other extensions using > read_stream_reset(), we could make the read stream reset which > preserves the distance a different function in backbranches. Hmm, yeah, interesting idea. Candidate names might include read_stream_restart() and read_stream_continue(). The point being that the block number callback reported end-of-stream, but that was only temporary, and now it has more information and would like to continue. Those are some of the names I bounced around for a new read_stream_reset() flag argument for v19 (I rather liked "continue"), but I also like this separate function idea. Back-patching a new function would certainly remove all doubt about unintended consequences for existing callers of read_stream_reset(), so yeah, that wins on pure conservative safety grounds. As for the future, hmm, it might even be better to have an explicit separate API for this operation in master too, as it is turning out to be quite a common requirement and the naming is much clearer like that. We don't usually design new APIs while back-patching though, that's probably why I didn't think of that, but if we view this as a design bug that folded too many jobs into read_stream_reset() that we now want to fix by splitting one off, maybe that's OK? Seems pretty risk-free, anyway.