diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 305c319..b3fe994 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -650,9 +650,7 @@ mergeSimpleStats(SimpleStats *acc, SimpleStats *ss)
 static void
 initStats(StatsData *sd, double start_time)
 {
-	if (start_time != 0.0)
-		sd->start_time = start_time;
-
+	sd->start_time = start_time;
 	sd->cnt = 0;
 	sd->skipped = 0;
 	initSimpleStats(&sd->latency);
@@ -1776,55 +1774,38 @@ doLog(TState *thread, CState *st, FILE *logfile, instr_time *now,
 	if (agg_interval > 0)
 	{
 		/*
-		 * Are we still in the same interval? If yes, accumulate the values
-		 * (print them otherwise)
+		 * Loop until we reach the interval of the current transaction,
+		 * and print all the empty intervals in between (this may happen
+		 * with very low tps, e.g. --rate=0.1).
 		 */
-		if (agg->start_time + agg_interval >= INSTR_TIME_GET_DOUBLE(*now))
+		while (agg->start_time + agg_interval < INSTR_TIME_GET_DOUBLE(*now))
 		{
-			doStats(agg, skipped, latency, lag);
-		}
-		else
-		{
-			/*
-			 * Loop until we reach the interval of the current transaction
-			 * (and print all the empty intervals in between).
-			 */
-			while (agg->start_time + agg_interval < INSTR_TIME_GET_DOUBLE(*now))
+			/* print aggregated report to logfile */
+			fprintf(logfile, "%ld " INT64_FORMAT " %.0f %.0f %.0f %.0f",
+					agg->start_time,
+					agg->cnt,
+					agg->latency.sum,
+					agg->latency.sum2,
+					agg->latency.min,
+					agg->latency.max);
+			if (throttle_delay)
 			{
-				/*
-				 * This is a non-Windows branch (thanks to the ifdef in
-				 * usage), so we don't need to handle this in a special way
-				 * (see below).
-				 */
-				fprintf(logfile, "%ld " INT64_FORMAT " %.0f %.0f %.0f %.0f",
-						agg->start_time,
-						agg->cnt,
-						agg->latency.sum,
-						agg->latency.sum2,
-						agg->latency.min,
-						agg->latency.max);
-				if (throttle_delay)
-				{
-					fprintf(logfile, " %.0f %.0f %.0f %.0f",
-							agg->lag.sum,
-							agg->lag.sum2,
-							agg->lag.min,
-							agg->lag.max);
-					if (latency_limit)
-						fprintf(logfile, " " INT64_FORMAT, agg->skipped);
-				}
-				fputc('\n', logfile);
-
-				/* move to the next interval */
-				agg->start_time += agg_interval;
-
-				/* reset for "no transaction" intervals */
-				initStats(agg, 0.0);
+				fprintf(logfile, " %.0f %.0f %.0f %.0f",
+						agg->lag.sum,
+						agg->lag.sum2,
+						agg->lag.min,
+						agg->lag.max);
+				if (latency_limit)
+					fprintf(logfile, " " INT64_FORMAT, agg->skipped);
 			}
+			fputc('\n', logfile);
 
-			/* reset the values to include only the current transaction. */
-			doStats(agg, skipped, latency, lag);
+			/* reset data and move to next interval */
+			initStats(agg, agg->start_time + agg_interval);
 		}
+
+		/* accumulate the current transaction */
+		doStats(agg, skipped, latency, lag);
 	}
 	else
 	{
@@ -3822,7 +3803,12 @@ done:
 	INSTR_TIME_SET_CURRENT(end);
 	INSTR_TIME_ACCUM_DIFF(thread->conn_time, end, start);
 	if (logfile)
+	{
+		if (agg_interval)
+			/* log aggregated but not yet reported transactions */
+			doLog(thread, state, logfile, &end, &aggs, false, 0, 0);
 		fclose(logfile);
+	}
 	return NULL;
 }
 
