Added notice when index created with little data [skip ci]

This commit is contained in:
Andrew Kane
2023-04-10 21:28:24 -07:00
parent 00148dfa1f
commit 1b013a94f7
2 changed files with 14 additions and 0 deletions

View File

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

View File

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