From 8e88b481a66b3e636d64625759e1485c99789af3 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Thu, 10 Oct 2024 20:57:57 -0700 Subject: [PATCH] Use a lower max allocation size than default to allow scanning more tuples for iterative search before exceeding work_mem [skip ci] --- src/hnswscan.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hnswscan.c b/src/hnswscan.c index b473e2b..1b103eb 100644 --- a/src/hnswscan.c +++ b/src/hnswscan.c @@ -118,9 +118,14 @@ hnswbeginscan(Relation index, int nkeys, int norderbys) so->first = true; so->v.tids = NULL; so->discarded = NULL; + + /* + * Use a lower max allocation size than default to allow scanning more + * tuples for iterative search before exceeding work_mem + */ so->tmpCtx = AllocSetContextCreate(CurrentMemoryContext, "Hnsw scan temporary context", - ALLOCSET_DEFAULT_SIZES); + 0, 8 * 1024, 512 * 1024); /* Set support functions */ HnswInitSupport(&so->support, index);