From 04d5e934a1ba895d103a9eda51e6d463ef6dee7d Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sun, 27 Oct 2024 22:23:28 -0700 Subject: [PATCH] Scan 2000 more tuples with default work_mem --- src/hnswscan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hnswscan.c b/src/hnswscan.c index 1cf677c..f38057b 100644 --- a/src/hnswscan.c +++ b/src/hnswscan.c @@ -137,10 +137,11 @@ hnswbeginscan(Relation index, int nkeys, int norderbys) */ so->tmpCtx = AllocSetContextCreate(CurrentMemoryContext, "Hnsw scan temporary context", - 0, 8 * 1024, 512 * 1024); + 0, 8 * 1024, 256 * 1024); /* Calculate max memory */ - maxMemory = (double) work_mem * hnsw_scan_mem_multiplier * 1024.0; + /* Add 256 extra bytes to fill last block when close */ + maxMemory = (double) work_mem * hnsw_scan_mem_multiplier * 1024.0 + 256; so->maxMemory = Min(maxMemory, (double) SIZE_MAX); scan->opaque = so;