mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-03 11:10:56 +08:00
Updated default value of hnsw.scan_mem_multiplier [skip ci]
This commit is contained in:
@@ -505,10 +505,10 @@ SET hnsw.max_scan_tuples = 20000;
|
||||
|
||||
Note: This is approximate and does not apply to the initial scan
|
||||
|
||||
When increasing this, you may also need to increase the max amount of memory an iterative scan can use, which is a multiple of `work_mem` (2 by default)
|
||||
When increasing this, you may also need to increase the max amount of memory an iterative scan can use, which is a multiple of `work_mem` (1 by default)
|
||||
|
||||
```sql
|
||||
SET hnsw.scan_mem_multiplier = 4;
|
||||
SET hnsw.scan_mem_multiplier = 2;
|
||||
```
|
||||
|
||||
You can see when this is needed by enabling debug messages
|
||||
@@ -520,7 +520,7 @@ SET client_min_messages = debug1;
|
||||
which will show when a scan reaches the memory limit
|
||||
|
||||
```text
|
||||
DEBUG: hnsw index scan reached memory limit after 40000 tuples
|
||||
DEBUG: hnsw index scan reached memory limit after 20000 tuples
|
||||
HINT: Increase hnsw.scan_mem_multiplier to scan more tuples.
|
||||
```
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ HnswInit(void)
|
||||
/* Same range and default as hash_mem_multiplier */
|
||||
DefineCustomRealVariable("hnsw.scan_mem_multiplier", "Sets the multiple of work_mem to use for iterative scans",
|
||||
NULL, &hnsw_scan_mem_multiplier,
|
||||
2, 1, 1000, PGC_USERSET, 0, NULL, NULL, NULL);
|
||||
1, 1, 1000, PGC_USERSET, 0, NULL, NULL, NULL);
|
||||
|
||||
MarkGUCPrefixReserved("hnsw");
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ ERROR: 0 is outside the valid range for parameter "hnsw.max_scan_tuples" (1 ..
|
||||
SHOW hnsw.scan_mem_multiplier;
|
||||
hnsw.scan_mem_multiplier
|
||||
--------------------------
|
||||
2
|
||||
1
|
||||
(1 row)
|
||||
|
||||
SET hnsw.scan_mem_multiplier = 0;
|
||||
|
||||
Reference in New Issue
Block a user