pgvector.git / summary / log / commit / refs
commit 24522700b89d0a8efc96ef0f3dfa094d524a3fd3
Author: Andrew Kane <andrew@ankane.org>
Date: Tue Oct 22 06:41:32 2024 +0000
Improved hnswrescan
src/hnswscan.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/hnswscan.c b/src/hnswscan.c
index 367723c8..3006a05b 100644
--- a/src/hnswscan.c
+++ b/src/hnswscan.c
@@ -126,9 +126,6 @@ hnswbeginscan(Relation index, int nkeys, int norderbys)
so = (HnswScanOpaque) palloc(sizeof(HnswScanOpaqueData));
so->typeInfo = HnswGetTypeInfo(index);
- so->first = true;
- so->v.tids = NULL;
- so->discarded = NULL;
/*
* Use a lower max allocation size than default to allow scanning more
@@ -154,13 +151,10 @@ hnswrescan(IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys, int no
{
HnswScanOpaque so = (HnswScanOpaque) scan->opaque;
- if (so->v.tids != NULL)
- tidhash_reset(so->v.tids);
-
- if (so->discarded != NULL)
- pairingheap_reset(so->discarded);
-
so->first = true;
+ /* v and discarded are allocated in tmpCtx */
+ so->v.tids = NULL;
+ so->discarded = NULL;
so->tuples = 0;
so->previousDistance = -get_float8_infinity();
MemoryContextReset(so->tmpCtx);
[parent: bfb3a45b31be]