From 8c5c0f791e866880f9ac4a281d87f55475c8b61f Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 16 Aug 2023 16:31:11 -0700 Subject: [PATCH] Improved HNSW insert code [skip ci] --- src/hnswinsert.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hnswinsert.c b/src/hnswinsert.c index 87e0dc6..0e52f10 100644 --- a/src/hnswinsert.c +++ b/src/hnswinsert.c @@ -344,8 +344,13 @@ UpdateNeighborPages(Relation index, FmgrInfo *procinfo, Oid collation, HnswEleme /* Find free offset if still exists */ /* TODO Retry updating connections if not */ for (int j = 0; j < lm; j++) + { if (!ItemPointerIsValid(&ntup->indextids[startIdx + j])) + { idx = startIdx + j; + break; + } + } } else idx += startIdx;