diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index a283e4d45c..2b0369d136 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -3069,11 +3069,11 @@ show_hashagg_info(AggState *aggstate, ExplainState *es)
 			return;
 
 		/* EXPLAIN ANALYZE */
+		ExplainPropertyInteger("HashAgg Batches", NULL,
+							   aggstate->hash_batches_used, es);
 		ExplainPropertyInteger("Peak Memory Usage", "kB", memPeakKb, es);
 		ExplainPropertyInteger("Disk Usage", "kB",
 							   aggstate->hash_disk_used, es);
-		ExplainPropertyInteger("HashAgg Batches", NULL,
-							   aggstate->hash_batches_used, es);
 	}
 	else
 	{
@@ -3099,13 +3099,13 @@ show_hashagg_info(AggState *aggstate, ExplainState *es)
 		else
 			appendStringInfoString(es->str, "  ");
 
-		appendStringInfo(es->str, "Peak Memory Usage: " INT64_FORMAT "kB",
-						 memPeakKb);
+		appendStringInfo(es->str, "Batches: %d  Memory Usage: " INT64_FORMAT "kB",
+						 aggstate->hash_batches_used, memPeakKb);
 
-		if (aggstate->hash_batches_used > 0)
-			appendStringInfo(es->str, "  Disk Usage: " UINT64_FORMAT "kB  HashAgg Batches: %d",
-							 aggstate->hash_disk_used,
-							 aggstate->hash_batches_used);
+		/* Only display disk usage if we spilled to disk */
+		if (aggstate->hash_batches_used > 1)
+			appendStringInfo(es->str, "  Disk Usage: " UINT64_FORMAT "kB",
+							 aggstate->hash_disk_used);
 		appendStringInfoChar(es->str, '\n');
 	}
 
@@ -3130,21 +3130,22 @@ show_hashagg_info(AggState *aggstate, ExplainState *es)
 			{
 				ExplainIndentText(es);
 
-				appendStringInfo(es->str, "Peak Memory Usage: " INT64_FORMAT "kB",
-								 memPeakKb);
+				appendStringInfo(es->str, "Batches: %d  Memory Usage: " INT64_FORMAT "kB",
+								 hash_batches_used, memPeakKb);
 
-				if (hash_batches_used > 0)
-					appendStringInfo(es->str, "  Disk Usage: " UINT64_FORMAT "kB  HashAgg Batches: %d",
-									 hash_disk_used, hash_batches_used);
+				/* Only display disk usage if we spilled to disk */
+				if (hash_batches_used > 1)
+					appendStringInfo(es->str, "  Disk Usage: " UINT64_FORMAT "kB",
+									 hash_disk_used);
 				appendStringInfoChar(es->str, '\n');
 			}
 			else
 			{
+				ExplainPropertyInteger("HashAgg Batches", NULL,
+									   hash_batches_used, es);
 				ExplainPropertyInteger("Peak Memory Usage", "kB", memPeakKb,
 									   es);
 				ExplainPropertyInteger("Disk Usage", "kB", hash_disk_used, es);
-				ExplainPropertyInteger("HashAgg Batches", NULL,
-									   hash_batches_used, es);
 			}
 
 			if (es->workers_state)
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index b79c845a6b..57824a2b8d 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -3646,6 +3646,9 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 		find_hash_columns(aggstate);
 		build_hash_tables(aggstate);
 		aggstate->table_filled = false;
+
+		/* Initialize this to 1, meaning nothing spilled, yet */
+		aggstate->hash_batches_used = 1;
 	}
 
 	/*
