Updated range and defaults for iterative search parameters

This commit is contained in:
Andrew Kane
2024-10-21 20:38:50 -07:00
parent 049972a4a3
commit e718eb8da4
9 changed files with 17 additions and 36 deletions

View File

@@ -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");
}

View File

@@ -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;

View File

@@ -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");
}

View File

@@ -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;