Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita2a0b37

Browse files
committed
Removed memory limit debug message from HNSW index scans (EXPLAIN ANALYZE can be used instead)
1 parent2f77030 commita2a0b37

File tree

2 files changed

+3
-29
lines changed

2 files changed

+3
-29
lines changed

‎README.md‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -537,18 +537,7 @@ Specify the max amount of memory to use, as a multiple of `work_mem` (1 by defau
537537
SEThnsw.scan_mem_multiplier=2;
538538
```
539539

540-
You can see when increasing this is needed by enabling debug messages
541-
542-
```sql
543-
SET client_min_messages= debug1;
544-
```
545-
546-
which will show when a scan reaches the memory limit
547-
548-
```text
549-
DEBUG: hnsw index scan reached memory limit after 20000 tuples
550-
HINT: Increase hnsw.scan_mem_multiplier to scan more tuples.
551-
```
540+
Note: Try increasing this if increasing`hnsw.max_scan_tuples` does not improve recall
552541

553542
####IVFFlat
554543

‎src/hnswscan.c‎

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -240,30 +240,15 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
240240
if (so->discarded==NULL)
241241
break;
242242

243-
/* Reached max number of tuples */
244-
if (so->tuples >=hnsw_max_scan_tuples)
243+
/* Reached max number of tuplesor memory limit*/
244+
if (so->tuples >=hnsw_max_scan_tuples||MemoryContextMemAllocated(so->tmpCtx, false)>so->maxMemory)
245245
{
246246
if (pairingheap_is_empty(so->discarded))
247247
break;
248248

249249
/* Return remaining tuples */
250250
so->w=lappend(so->w,HnswGetSearchCandidate(w_node,pairingheap_remove_first(so->discarded)));
251251
}
252-
/* Prevent scans from consuming too much memory */
253-
elseif (MemoryContextMemAllocated(so->tmpCtx, false)>so->maxMemory)
254-
{
255-
if (pairingheap_is_empty(so->discarded))
256-
{
257-
ereport(DEBUG1,
258-
(errmsg("hnsw index scan reached memory limit after "INT64_FORMAT" tuples",so->tuples),
259-
errhint("Increase hnsw.scan_mem_multiplier to scan more tuples.")));
260-
261-
break;
262-
}
263-
264-
/* Return remaining tuples */
265-
so->w=lappend(so->w,HnswGetSearchCandidate(w_node,pairingheap_remove_first(so->discarded)));
266-
}
267252
else
268253
{
269254
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp