diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index 1467355..1345e8d 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -4865,13 +4865,13 @@ pgstat_recv_inquiry(PgStat_MsgInquiry *msg, int len)
 	}
 
 	/*
-	 * There's no request for this DB yet, so create one.
+	 * There's no request for this DB yet, so create one. Don't add it to the
+	 * list yet - we will check clock skew and the existing db entry first.
 	 */
 	newreq = palloc(sizeof(DBWriteRequest));
 
 	newreq->databaseid = msg->databaseid;
 	newreq->request_time = msg->clock_time;
-	slist_push_head(&last_statrequests, &newreq->next);
 
 	/*
 	 * If the requestor's local clock time is older than stats_timestamp, we
@@ -4908,6 +4908,28 @@ pgstat_recv_inquiry(PgStat_MsgInquiry *msg, int len)
 			dbentry->stats_timestamp = cur_ts - 1;
 		}
 	}
+
+	/*
+	 * Ignore requests that are already resolved by the last write.
+	 *
+	 * We discard the list of requests after writing the stats files, so the
+	 * requests that are already waiting on the UDP socket at that moment
+	 * won't be discarded in the loop at the beginning of the method. But we
+	 * can skip them here, if we found the database entry.
+	 *
+	 * We newer skip the requests if we detected clock skew, though. In that
+	 * case we want to write the files anyway, to get in sync. Simply check
+	 * whether we tweaked the request time in the previous block.
+	 */
+	if ((dbentry != NULL) && (msg->cutoff_time <= dbentry->stats_timestamp)
+						  && (newreq->request_time == msg->clock_time))
+	{
+		pfree(newreq);
+		return;
+	}
+
+	/* The file is stale or there was a clock skew, so request a write. */
+	slist_push_head(&last_statrequests, &newreq->next);
 }
 
 
