diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c
index 58682dc..e2f942f 100644
--- a/src/backend/commands/async.c
+++ b/src/backend/commands/async.c
@@ -384,6 +384,8 @@ static double asyncQueueUsage(void);
 static void asyncQueueFillWarning(void);
 static bool SignalBackends(void);
 static void asyncQueueReadAllNotifications(void);
+static void asyncQueueReadAllNotificationsWorker(volatile QueuePosition pos,
+									 QueuePosition head);
 static bool asyncQueueProcessPageEntries(volatile QueuePosition *current,
 							 QueuePosition stop,
 							 char *page_buffer);
@@ -917,6 +919,7 @@ static void
 Exec_ListenPreCommit(void)
 {
 	QueuePosition max;
+	QueuePosition head;
 	int i;
 
 	/*
@@ -949,6 +952,7 @@ Exec_ListenPreCommit(void)
 	 */
 	LWLockAcquire(AsyncQueueLock, LW_SHARED);
 	max = QUEUE_TAIL;
+	head = QUEUE_HEAD;
 	/*
 	 * If there is over a page of notifications queued, then we should find
 	 * the maximum position of all backends connected to our database, to
@@ -957,7 +961,7 @@ Exec_ListenPreCommit(void)
 	 * a significant performance problem with listen when there is a long
 	 * running transaction
 	 */
-	if( QUEUE_POS_PAGE(max) < QUEUE_POS_PAGE(QUEUE_HEAD) )
+	if( QUEUE_POS_PAGE(max) < QUEUE_POS_PAGE(head) )
 	{
 		for (i = 1; i <= MaxBackends; i++)
 		{
@@ -983,7 +987,10 @@ Exec_ListenPreCommit(void)
 	 *
 	 * This will also advance the global tail pointer if possible.
 	 */
-	asyncQueueReadAllNotifications();
+	if (!QUEUE_POS_EQUAL(max,head))
+	{
+		asyncQueueReadAllNotificationsWorker(max,head);
+	}
 }
 
 /*
@@ -1732,23 +1739,14 @@ ProcessNotifyInterrupt(void)
 static void
 asyncQueueReadAllNotifications(void)
 {
-	volatile QueuePosition pos;
-	QueuePosition oldpos;
+	QueuePosition pos;
 	QueuePosition head;
-	bool		advanceTail;
-
-	/* page_buffer must be adequately aligned, so use a union */
-	union
-	{
-		char		buf[QUEUE_PAGESIZE];
-		AsyncQueueEntry align;
-	}			page_buffer;
 
 	/* Fetch current state */
 	LWLockAcquire(AsyncQueueLock, LW_SHARED);
 	/* Assert checks that we have a valid state entry */
 	Assert(MyProcPid == QUEUE_BACKEND_PID(MyBackendId));
-	pos = oldpos = QUEUE_BACKEND_POS(MyBackendId);
+	pos = QUEUE_BACKEND_POS(MyBackendId);
 	head = QUEUE_HEAD;
 	LWLockRelease(AsyncQueueLock);
 
@@ -1757,6 +1755,24 @@ asyncQueueReadAllNotifications(void)
 		/* Nothing to do, we have read all notifications already. */
 		return;
 	}
+	asyncQueueReadAllNotificationsWorker(pos, head);
+}
+
+static void
+asyncQueueReadAllNotificationsWorker(volatile QueuePosition pos,
+									 QueuePosition head)
+{
+	QueuePosition oldpos;
+	bool 		advanceTail;
+
+	/* page_buffer must be adequately aligned, so use a union */
+	union
+	{
+		char		buf[QUEUE_PAGESIZE];
+		AsyncQueueEntry align;
+	}			page_buffer;
+
+	oldpos = pos;
 
 	/*----------
 	 * Note that we deliver everything that we see in the queue and that
