mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-01 10:11:20 +08:00
Added max_probes option [skip ci]
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#endif
|
||||
|
||||
int ivfflat_probes;
|
||||
int ivfflat_max_probes;
|
||||
bool ivfflat_streaming;
|
||||
static relopt_kind ivfflat_relopt_kind;
|
||||
|
||||
@@ -34,6 +35,10 @@ IvfflatInit(void)
|
||||
"Valid range is 1..lists.", &ivfflat_probes,
|
||||
IVFFLAT_DEFAULT_PROBES, IVFFLAT_MIN_LISTS, IVFFLAT_MAX_LISTS, PGC_USERSET, 0, NULL, NULL, NULL);
|
||||
|
||||
DefineCustomIntVariable("ivfflat.max_probes", "Sets the max number of probes for iterative scans",
|
||||
NULL, &ivfflat_max_probes,
|
||||
-1, IVFFLAT_MIN_LISTS, IVFFLAT_MAX_LISTS, PGC_USERSET, 0, NULL, NULL, NULL);
|
||||
|
||||
DefineCustomBoolVariable("ivfflat.streaming", "Use streaming mode",
|
||||
NULL, &ivfflat_streaming,
|
||||
IVFFLAT_DEFAULT_STREAMING, PGC_USERSET, 0, NULL, NULL, NULL);
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
|
||||
/* Variables */
|
||||
extern int ivfflat_probes;
|
||||
extern int ivfflat_max_probes;
|
||||
extern bool ivfflat_streaming;
|
||||
|
||||
typedef struct VectorArrayData
|
||||
|
||||
@@ -262,7 +262,15 @@ ivfflatbeginscan(Relation index, int nkeys, int norderbys)
|
||||
if (probes > lists)
|
||||
probes = lists;
|
||||
|
||||
maxProbes = ivfflat_streaming ? lists : probes;
|
||||
if (ivfflat_streaming)
|
||||
{
|
||||
if (ivfflat_max_probes == -1)
|
||||
maxProbes = lists;
|
||||
else
|
||||
maxProbes = ivfflat_max_probes;
|
||||
}
|
||||
else
|
||||
maxProbes = probes;
|
||||
|
||||
so = (IvfflatScanOpaque) palloc(offsetof(IvfflatScanOpaqueData, lists) + maxProbes * sizeof(IvfflatScanList));
|
||||
so->typeInfo = IvfflatGetTypeInfo(index);
|
||||
|
||||
Reference in New Issue
Block a user