mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-01 10:11:20 +08:00
Updated range and defaults for iterative search parameters
This commit is contained in:
@@ -84,8 +84,8 @@ HnswInit(void)
|
||||
|
||||
/* This is approximate and does not apply to the initial scan */
|
||||
DefineCustomIntVariable("hnsw.max_search_tuples", "Sets the max number of candidates to visit for iterative search",
|
||||
"-1 means no limit", &hnsw_max_search_tuples,
|
||||
-1, -1, INT_MAX, PGC_USERSET, 0, NULL, NULL, NULL);
|
||||
NULL, &hnsw_max_search_tuples,
|
||||
20000, 1, INT_MAX, PGC_USERSET, 0, NULL, NULL, NULL);
|
||||
|
||||
MarkGUCPrefixReserved("hnsw");
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
|
||||
break;
|
||||
|
||||
/* Reached max number of tuples */
|
||||
if (hnsw_max_search_tuples != -1 && so->tuples >= hnsw_max_search_tuples)
|
||||
if (so->tuples >= hnsw_max_search_tuples)
|
||||
{
|
||||
if (pairingheap_is_empty(so->discarded))
|
||||
break;
|
||||
|
||||
@@ -47,8 +47,8 @@ IvfflatInit(void)
|
||||
|
||||
/* If this is less than probes, probes is used */
|
||||
DefineCustomIntVariable("ivfflat.max_probes", "Sets the max number of probes for iterative search",
|
||||
"-1 means no limit", &ivfflat_max_probes,
|
||||
-1, -1, IVFFLAT_MAX_LISTS, PGC_USERSET, 0, NULL, NULL, NULL);
|
||||
NULL, &ivfflat_max_probes,
|
||||
IVFFLAT_MAX_LISTS, IVFFLAT_MIN_LISTS, IVFFLAT_MAX_LISTS, PGC_USERSET, 0, NULL, NULL, NULL);
|
||||
|
||||
MarkGUCPrefixReserved("ivfflat");
|
||||
}
|
||||
|
||||
@@ -264,17 +264,7 @@ ivfflatbeginscan(Relation index, int nkeys, int norderbys)
|
||||
IvfflatGetMetaPageInfo(index, &lists, &dimensions);
|
||||
|
||||
if (ivfflat_iterative_search != IVFFLAT_ITERATIVE_SEARCH_OFF)
|
||||
{
|
||||
maxProbes = ivfflat_max_probes;
|
||||
|
||||
if (maxProbes < 0)
|
||||
maxProbes = lists;
|
||||
else if (maxProbes < probes)
|
||||
{
|
||||
/* TODO Show notice */
|
||||
maxProbes = probes;
|
||||
}
|
||||
}
|
||||
maxProbes = Max(ivfflat_max_probes, probes);
|
||||
else
|
||||
maxProbes = probes;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user