diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index 9568ff1..af2486e 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -2800,6 +2800,7 @@ void TruncateMultiXact(void) { MultiXactId oldestMXact; + MultiXactId nextMultiXactId; MultiXactOffset oldestOffset; MultiXactOffset nextOffset; mxtruncinfo trunc; @@ -2811,9 +2812,14 @@ TruncateMultiXact(void) LWLockAcquire(MultiXactGenLock, LW_SHARED); oldestMXact = MultiXactState->lastCheckpointedOldest; + nextMultiXactId = MultiXactState->nextMXact; LWLockRelease(MultiXactGenLock); Assert(MultiXactIdIsValid(oldestMXact)); + /* If there are no multixacts, there is nothing to do. */ + if (nextMultiXactId == oldestMXact) + return; + /* * Note we can't just plow ahead with the truncation; it's possible that * there are no segments to truncate, which is a problem because we are