typedef struct
{
SpGistState spgstate; /* SPGiST's working state */
+ int64 indtuples; /* total number of tuples indexed */
MemoryContext tmpCtx; /* per-tuple temporary context */
} SpGistBuildState;
MemoryContextReset(buildstate->tmpCtx);
}
+ /* Update total tuple count */
+ buildstate->indtuples += 1;
+
MemoryContextSwitchTo(oldCtx);
MemoryContextReset(buildstate->tmpCtx);
}
*/
initSpGistState(&buildstate.spgstate, index);
buildstate.spgstate.isBuild = true;
+ buildstate.indtuples = 0;
buildstate.tmpCtx = AllocSetContextCreate(CurrentMemoryContext,
"SP-GiST build temporary context",
SpGistUpdateMetaPage(index);
result = (IndexBuildResult *) palloc0(sizeof(IndexBuildResult));
- result->heap_tuples = result->index_tuples = reltuples;
+ result->heap_tuples = reltuples;
+ result->index_tuples = buildstate.indtuples;
return result;
}