From 1b013a94f7c0b0e06ecc7f096db9a35f91321e5d Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Mon, 10 Apr 2023 21:28:24 -0700 Subject: [PATCH] Added notice when index created with little data [skip ci] --- CHANGELOG.md | 4 ++++ src/ivfbuild.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dff48c5..23865e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.2 (unreleased) + +- Added notice when index created with little data + ## 0.4.1 (2023-03-21) - Improved performance of cosine distance diff --git a/src/ivfbuild.c b/src/ivfbuild.c index 9a3697c..854207a 100644 --- a/src/ivfbuild.c +++ b/src/ivfbuild.c @@ -431,8 +431,18 @@ ComputeCenters(IvfflatBuildState * buildstate) /* TODO Ensure within maintenance_work_mem */ buildstate->samples = VectorArrayInit(numSamples, buildstate->dimensions); if (buildstate->heap != NULL) + { SampleRows(buildstate); + if (buildstate->samples->length < buildstate->lists) + { + ereport(NOTICE, + (errmsg("index created with little data"), + errdetail("this will cause poor recall"), + errhint("drop the index until the table has more data"))); + } + } + /* Calculate centers */ IvfflatBench("k-means", IvfflatKmeans(buildstate->index, buildstate->samples, buildstate->centers));