From b7c5c53a210ecf1895e70d206f1d67a9e4f13163 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Thu, 30 Sep 2021 01:58:11 -0500
Subject: [PATCH 3/3] Justin's changes

---
 src/backend/commands/explain.c                | 24 +++++++++----------
 src/test/regress/expected/partition_prune.out | 14 +++++------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 428a073099..756051864c 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -4008,15 +4008,16 @@ show_loop_info(Instrumentation *instrument, bool isworker, ExplainState *es)
 
 		if (nloops > 1 && es->verbose)
 		{
-			appendStringInfo(es->str, "\n");
+			appendStringInfoChar(es->str, '\n');
 			ExplainIndentText(es);
+
 			if (es->timing)
 				appendStringInfo(es->str,
-								 "Loop min_time: %.3f  max_time: %.3f  min_rows: %.0f  max_rows: %.0f  total_rows: %.0f",
-								 loop_min_t_ms, loop_max_t_ms, loop_min_r, loop_max_r, loop_total_rows);
+								 "Loop Min Rows: %.0f  Max Rows: %.0f  Total Rows: %.0f  Min Time: %.3f  Max Time: %.3f",
+								 loop_min_r, loop_max_r, loop_total_rows, loop_min_t_ms, loop_max_t_ms);
 			else
 				appendStringInfo(es->str,
-								 "Loop min_rows: %.0f  max_rows: %.0f  total_rows: %.0f",
+								 "Loop Min Rows: %.0f  Max Rows: %.0f  Total Rows: %.0f",
 								 loop_min_r, loop_max_r, loop_total_rows);
 		}
 	}
@@ -4028,14 +4029,13 @@ show_loop_info(Instrumentation *instrument, bool isworker, ExplainState *es)
 								 3, es);
 			ExplainPropertyFloat("Actual Total Time", "ms", total_ms,
 								 3, es);
-		}
-
-		if (nloops > 1 && es->verbose)
-		{
-			ExplainPropertyFloat("Loop Min Time", "s", loop_min_t_ms,
-								 3, es);
-			ExplainPropertyFloat("Loop Max Time", "s", loop_max_t_ms,
-								 3, es);
+			if (nloops > 1 && es->verbose)
+			{
+				ExplainPropertyFloat("Loop Min Time", "ms", loop_min_t_ms,
+									 3, es);
+				ExplainPropertyFloat("Loop Max Time", "ms", loop_max_t_ms,
+									 3, es);
+			}
 		}
 
 		ExplainPropertyFloat("Actual Rows", NULL, rows, 0, es);
diff --git a/src/test/regress/expected/partition_prune.out b/src/test/regress/expected/partition_prune.out
index 0e1242c089..d9d77090dc 100644
--- a/src/test/regress/expected/partition_prune.out
+++ b/src/test/regress/expected/partition_prune.out
@@ -2725,17 +2725,17 @@ select * from tbl1 inner join tprt on tbl1.col1 > tprt.col1;
    ->  Seq Scan on public.tbl1 (actual rows=5 loops=1)
          Output: tbl1.col1
    ->  Append (actual rows=5 loops=5)
-         Loop min_rows: 2  max_rows: 6  total_rows: 23
+         Loop Min Rows: 2  Max Rows: 6  Total Rows: 23
          ->  Index Scan using tprt1_idx on public.tprt_1 (actual rows=2 loops=5)
-               Loop min_rows: 2  max_rows: 2  total_rows: 10
+               Loop Min Rows: 2  Max Rows: 2  Total Rows: 10
                Output: tprt_1.col1
                Index Cond: (tprt_1.col1 < tbl1.col1)
          ->  Index Scan using tprt2_idx on public.tprt_2 (actual rows=3 loops=4)
-               Loop min_rows: 2  max_rows: 3  total_rows: 11
+               Loop Min Rows: 2  Max Rows: 3  Total Rows: 11
                Output: tprt_2.col1
                Index Cond: (tprt_2.col1 < tbl1.col1)
          ->  Index Scan using tprt3_idx on public.tprt_3 (actual rows=1 loops=2)
-               Loop min_rows: 1  max_rows: 1  total_rows: 2
+               Loop Min Rows: 1  Max Rows: 1  Total Rows: 2
                Output: tprt_3.col1
                Index Cond: (tprt_3.col1 < tbl1.col1)
          ->  Index Scan using tprt4_idx on public.tprt_4 (never executed)
@@ -2758,16 +2758,16 @@ select * from tbl1 inner join tprt on tbl1.col1 = tprt.col1;
    ->  Seq Scan on public.tbl1 (actual rows=5 loops=1)
          Output: tbl1.col1
    ->  Append (actual rows=1 loops=5)
-         Loop min_rows: 0  max_rows: 1  total_rows: 3
+         Loop Min Rows: 0  Max Rows: 1  Total Rows: 3
          ->  Index Scan using tprt1_idx on public.tprt_1 (never executed)
                Output: tprt_1.col1
                Index Cond: (tprt_1.col1 = tbl1.col1)
          ->  Index Scan using tprt2_idx on public.tprt_2 (actual rows=1 loops=2)
-               Loop min_rows: 1  max_rows: 1  total_rows: 2
+               Loop Min Rows: 1  Max Rows: 1  Total Rows: 2
                Output: tprt_2.col1
                Index Cond: (tprt_2.col1 = tbl1.col1)
          ->  Index Scan using tprt3_idx on public.tprt_3 (actual rows=0 loops=3)
-               Loop min_rows: 0  max_rows: 1  total_rows: 1
+               Loop Min Rows: 0  Max Rows: 1  Total Rows: 1
                Output: tprt_3.col1
                Index Cond: (tprt_3.col1 = tbl1.col1)
          ->  Index Scan using tprt4_idx on public.tprt_4 (never executed)
-- 
2.17.0

