Added streaming option for HNSW

This commit is contained in:
Andrew Kane
2024-09-22 12:02:48 -07:00
parent 97cf990e0f
commit 80cbd32dab
8 changed files with 421 additions and 41 deletions

View File

@@ -18,6 +18,7 @@
#endif
int hnsw_ef_search;
bool hnsw_streaming;
int hnsw_lock_tranche_id;
static relopt_kind hnsw_relopt_kind;
@@ -68,6 +69,13 @@ HnswInit(void)
"Valid range is 1..1000.", &hnsw_ef_search,
HNSW_DEFAULT_EF_SEARCH, HNSW_MIN_EF_SEARCH, HNSW_MAX_EF_SEARCH, PGC_USERSET, 0, NULL, NULL, NULL);
/* TODO Figure out name */
DefineCustomBoolVariable("hnsw.streaming", "Use streaming mode",
NULL, &hnsw_streaming,
HNSW_DEFAULT_STREAMING, PGC_USERSET, 0, NULL, NULL, NULL);
/* TODO Add option for limiting iterative search */
MarkGUCPrefixReserved("hnsw");
}
@@ -126,6 +134,8 @@ hnswcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
/* Account for number of tuples (or entry level), m, and ef_search */
costs.numIndexTuples = (entryLevel + 2) * m;
/* TODO Adjust for selectivity for iterative scans */
genericcostestimate(root, path, loop_count, &costs);
/* Use total cost since most work happens before first tuple is returned */