From 0f69cc789a6513459e306127f4c95ad8daf7ce8f Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Fri, 23 Dec 2022 08:07:09 -0800 Subject: [PATCH] Combined sampling table and performing k-means phases --- src/ivfbuild.c | 5 ++--- src/ivfflat.c | 2 -- src/ivfflat.h | 7 +++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/ivfbuild.c b/src/ivfbuild.c index 8b3924a..81c7352 100644 --- a/src/ivfbuild.c +++ b/src/ivfbuild.c @@ -98,8 +98,6 @@ SampleRows(IvfflatBuildState * buildstate) int targsamples = buildstate->samples->maxlen; BlockNumber totalblocks = RelationGetNumberOfBlocks(buildstate->heap); - UpdateProgress(PROGRESS_CREATEIDX_SUBPHASE, PROGRESS_IVFFLAT_PHASE_SAMPLE); - buildstate->rowstoskip = -1; BlockSampler_Init(&buildstate->bs, totalblocks, targsamples, RandomInt()); @@ -364,6 +362,8 @@ ComputeCenters(IvfflatBuildState * buildstate) { int numSamples; + UpdateProgress(PROGRESS_CREATEIDX_SUBPHASE, PROGRESS_IVFFLAT_PHASE_KMEANS); + /* Target 50 samples per list, with at least 10000 samples */ /* The number of samples has a large effect on index build time */ numSamples = buildstate->lists * 50; @@ -381,7 +381,6 @@ ComputeCenters(IvfflatBuildState * buildstate) SampleRows(buildstate); /* Calculate centers */ - UpdateProgress(PROGRESS_CREATEIDX_SUBPHASE, PROGRESS_IVFFLAT_PHASE_KMEANS); IvfflatBench("k-means", IvfflatKmeans(buildstate->index, buildstate->samples, buildstate->centers)); /* Free samples before we allocate more memory */ diff --git a/src/ivfflat.c b/src/ivfflat.c index 3731b28..677178c 100644 --- a/src/ivfflat.c +++ b/src/ivfflat.c @@ -45,8 +45,6 @@ ivfflatbuildphasename(int64 phasenum) { case PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE: return "initializing"; - case PROGRESS_IVFFLAT_PHASE_SAMPLE: - return "sampling table"; case PROGRESS_IVFFLAT_PHASE_KMEANS: return "performing k-means"; case PROGRESS_IVFFLAT_PHASE_SORT: diff --git a/src/ivfflat.h b/src/ivfflat.h index 93c4a47..d9345b2 100644 --- a/src/ivfflat.h +++ b/src/ivfflat.h @@ -42,10 +42,9 @@ /* Build phases */ /* PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE is 1 */ -#define PROGRESS_IVFFLAT_PHASE_SAMPLE 2 -#define PROGRESS_IVFFLAT_PHASE_KMEANS 3 -#define PROGRESS_IVFFLAT_PHASE_SORT 4 -#define PROGRESS_IVFFLAT_PHASE_LOAD 5 +#define PROGRESS_IVFFLAT_PHASE_KMEANS 2 +#define PROGRESS_IVFFLAT_PHASE_SORT 3 +#define PROGRESS_IVFFLAT_PHASE_LOAD 4 #define IVFFLAT_LIST_SIZE(_dim) (offsetof(IvfflatListData, center) + VECTOR_SIZE(_dim))