mirror of
https://github.com/pgvector/pgvector.git
synced 2026-12-04 00:08:30 +00:00
Changed default value of ivfflat.probes to -1 [skip ci]
This commit is contained in:
1 parent
a07c442e92
commit
1fa90d3bec
6 files changed
+13
-10
No files matched your search
+3
-3
@@ -52,8 +52,8 @@ IvfflatInit(void)
|
||||
IVFFLAT_DEFAULT_LISTS, IVFFLAT_MIN_LISTS, IVFFLAT_MAX_LISTS, AccessExclusiveLock);
|
||||
|
||||
DefineCustomIntVariable("ivfflat.probes", "Sets the number of probes",
|
||||
"Valid range is 0..lists.", &ivfflat_probes,
|
||||
IVFFLAT_DEFAULT_PROBES, 0, IVFFLAT_MAX_LISTS, PGC_USERSET, 0, NULL, NULL, NULL);
|
||||
"Valid range is -1..lists.", &ivfflat_probes,
|
||||
IVFFLAT_DEFAULT_PROBES, -1, IVFFLAT_MAX_LISTS, PGC_USERSET, 0, NULL, NULL, NULL);
|
||||
|
||||
DefineCustomEnumVariable("ivfflat.iterative_scan", "Sets the mode for iterative scans",
|
||||
NULL, &ivfflat_iterative_scan,
|
||||
@@ -106,7 +106,7 @@ ivfflatcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
|
||||
double spc_seq_page_cost;
|
||||
|
||||
/* Never use index without order */
|
||||
if (path->indexorderbys == NIL)
|
||||
if (path->indexorderbys == NIL || ivfflat_probes == 0)
|
||||
{
|
||||
*indexStartupCost = get_float8_infinity();
|
||||
*indexTotalCost = get_float8_infinity();
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ typedef Pointer Item;
|
||||
#define IVFFLAT_DEFAULT_LISTS 100
|
||||
#define IVFFLAT_MIN_LISTS 1
|
||||
#define IVFFLAT_MAX_LISTS 32768
|
||||
#define IVFFLAT_DEFAULT_PROBES 0
|
||||
#define IVFFLAT_DEFAULT_PROBES -1
|
||||
|
||||
/* Build phases */
|
||||
/* PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE is 1 */
|
||||
|
||||
@@ -270,6 +270,9 @@ ivfflatbeginscan(Relation index, int nkeys, int norderbys)
|
||||
|
||||
probes = IvfflatGetProbes(lists);
|
||||
|
||||
if (probes == 0)
|
||||
elog(ERROR, "No probes");
|
||||
|
||||
if (ivfflat_iterative_scan != IVFFLAT_ITERATIVE_SCAN_OFF)
|
||||
maxProbes = Max(ivfflat_max_probes, probes);
|
||||
else
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ IvfflatGetProbes(int lists)
|
||||
{
|
||||
int probes = ivfflat_probes;
|
||||
|
||||
if (probes == 0)
|
||||
if (probes == -1)
|
||||
return round(sqrt(lists));
|
||||
|
||||
return probes;
|
||||
|
||||
@@ -157,13 +157,13 @@ DROP TABLE t;
|
||||
SHOW ivfflat.probes;
|
||||
ivfflat.probes
|
||||
----------------
|
||||
0
|
||||
-1
|
||||
(1 row)
|
||||
|
||||
SET ivfflat.probes = -1;
|
||||
ERROR: -1 is outside the valid range for parameter "ivfflat.probes" (0 .. 32768)
|
||||
SET ivfflat.probes = -2;
|
||||
ERROR: -2 is outside the valid range for parameter "ivfflat.probes" (-1 .. 32768)
|
||||
SET ivfflat.probes = 32769;
|
||||
ERROR: 32769 is outside the valid range for parameter "ivfflat.probes" (0 .. 32768)
|
||||
ERROR: 32769 is outside the valid range for parameter "ivfflat.probes" (-1 .. 32768)
|
||||
SHOW ivfflat.iterative_scan;
|
||||
ivfflat.iterative_scan
|
||||
------------------------
|
||||
|
||||
@@ -87,7 +87,7 @@ CREATE INDEX ON t USING ivfflat (val vector_l2_ops) WITH (lists = 32769);
|
||||
DROP TABLE t;
|
||||
|
||||
SHOW ivfflat.probes;
|
||||
SET ivfflat.probes = -1;
|
||||
SET ivfflat.probes = -2;
|
||||
SET ivfflat.probes = 32769;
|
||||
|
||||
SHOW ivfflat.iterative_scan;
|
||||
|
||||
Reference in new issue
Block a user