summaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/gist/gist.c')
-rw-r--r--src/backend/access/gist/gist.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index f203bb594c..0683f42c25 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -1645,7 +1645,6 @@ gistprunepage(Relation rel, Page page, Buffer buffer, Relation heapRel)
int ndeletable = 0;
OffsetNumber offnum,
maxoff;
- TransactionId latestRemovedXid = InvalidTransactionId;
Assert(GistPageIsLeaf(page));
@@ -1664,13 +1663,15 @@ gistprunepage(Relation rel, Page page, Buffer buffer, Relation heapRel)
deletable[ndeletable++] = offnum;
}
- if (XLogStandbyInfoActive() && RelationNeedsWAL(rel))
- latestRemovedXid =
- index_compute_xid_horizon_for_tuples(rel, heapRel, buffer,
- deletable, ndeletable);
-
if (ndeletable > 0)
{
+ TransactionId latestRemovedXid = InvalidTransactionId;
+
+ if (XLogStandbyInfoActive() && RelationNeedsWAL(rel))
+ latestRemovedXid =
+ index_compute_xid_horizon_for_tuples(rel, heapRel, buffer,
+ deletable, ndeletable);
+
START_CRIT_SECTION();
PageIndexMultiDelete(page, deletable, ndeletable);