mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-03 11:10:56 +08:00
Co-authored-by: Itai Spiegel <itai@mave.com>
This commit is contained in:
@@ -447,6 +447,13 @@ ComputeCenters(IvfflatBuildState * buildstate)
|
||||
/* Skip samples for unlogged table */
|
||||
if (buildstate->heap == NULL)
|
||||
numSamples = 1;
|
||||
else
|
||||
{
|
||||
int64 maxTuples = (int64) RelationGetNumberOfBlocks(buildstate->heap) * MaxHeapTuplesPerPage;
|
||||
|
||||
/* Save memory since will not have more than max tuples */
|
||||
numSamples = Max(Min(numSamples, maxTuples), 1);
|
||||
}
|
||||
|
||||
/* Sample rows */
|
||||
buildstate->memoryUsed += VECTOR_ARRAY_SIZE(numSamples, buildstate->itemsize);
|
||||
|
||||
Reference in New Issue
Block a user