10000 Scan 2000 more tuples with default work_mem · postgrespro/pgvector@04d5e93 · GitHub
[go: up one dir, main page]

Skip to content

Commit 04d5e93

Browse files
committed
Scan 2000 more tuples with default work_mem
1 parent b163b5b commit 04d5e93

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/hnswscan.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,11 @@ hnswbeginscan(Relation index, int nkeys, int norderbys)
137137
*/
138138
so->tmpCtx = AllocSetContextCreate(CurrentMemoryContext,
139139
"Hnsw scan temporary context",
140-
0, 8 * 1024, 512 * 1024);
140+
0, 8 * 1024, 256 * 1024);
141141

142142
/* Calculate max memory */
143-
maxMemory = (double) work_mem * hnsw_scan_mem_multiplier * 1024.0;
143+
/* Add 256 extra bytes to fill last block when close */
144+
maxMemory = (double) work_mem * hnsw_scan_mem_multiplier * 1024.0 + 256;
144145
so->maxMemory = Min(maxMemory, (double) SIZE_MAX);
145146

146147
scan->opaque = so;

0 commit comments

Comments
 (0)
0