From 4cd98d47935eb59421fa9b4a8f2e971da2de3b32 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sat, 17 Oct 2026 22:09:51 -0700 Subject: [PATCH] Improved code [skip ci] --- src/hnswutils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hnswutils.c b/src/hnswutils.c index 6fc2169..b9c9fe6 100644 --- a/src/hnswutils.c +++ b/src/hnswutils.c @@ -863,8 +863,10 @@ HnswReadStreamNextBlock(ReadStream *stream, void *callback_private_data, void *p void HnswInitSearchState(HnswSearchState * searchState, Relation index, bool maintenance) { + bool inMemory = index == NULL; + #ifdef HNSW_USE_READ_STREAM - if (index != NULL) + if (!inMemory) { int flags = READ_STREAM_DEFAULT; @@ -876,7 +878,7 @@ HnswInitSearchState(HnswSearchState * searchState, Relation index, bool maintena else searchState->stream = NULL; #elif defined(HNSW_USE_PREFETCH) - if (index != NULL) + if (!inMemory) { if (maintenance) searchState->maxPrefetch = get_tablespace_maintenance_io_concurrency(index->rd_rel->reltablespace);