summaryrefslogtreecommitdiff
path: root/src/backend/access/spgist/spginsert.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/spgist/spginsert.c')
-rw-r--r--src/backend/access/spgist/spginsert.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/access/spgist/spginsert.c b/src/backend/access/spgist/spginsert.c
index 3eaa649eff3..fed658e5acf 100644
--- a/src/backend/access/spgist/spginsert.c
+++ b/src/backend/access/spgist/spginsert.c
@@ -31,6 +31,7 @@
typedef struct
{
SpGistState spgstate; /* SPGiST's working state */
+ int64 indtuples; /* total number of tuples indexed */
MemoryContext tmpCtx; /* per-tuple temporary context */
} SpGistBuildState;
@@ -58,6 +59,9 @@ spgistBuildCallback(Relation index, HeapTuple htup, Datum *values,
MemoryContextReset(buildstate->tmpCtx);
}
+ /* Update total tuple count */
+ buildstate->indtuples += 1;
+
MemoryContextSwitchTo(oldCtx);
MemoryContextReset(buildstate->tmpCtx);
}
@@ -131,6 +135,7 @@ spgbuild(Relation heap, Relation index, IndexInfo *indexInfo)
*/
initSpGistState(&buildstate.spgstate, index);
buildstate.spgstate.isBuild = true;
+ buildstate.indtuples = 0;
buildstate.tmpCtx = AllocSetContextCreate(CurrentMemoryContext,
"SP-GiST build temporary context",
@@ -144,7 +149,8 @@ spgbuild(Relation heap, Relation index, IndexInfo *indexInfo)
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;
}