pgvector.git / summary / log / commit / refs
commit 04d5e934a1ba895d103a9eda51e6d463ef6dee7d
Author: Andrew Kane <andrew@ankane.org>
Date: Mon Oct 28 05:23:28 2024 +0000
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 1cf677c8..f38057bf 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;
[parent: b163b5b196d6]