Space missing from EXPLAIN output

Started by Thom Brown11 months ago7 messages
#1Thom Brown
thom@linux.com
1 attachment(s)

Hi,

Commit ddb17e387aa introduced fractional row counts, but the rejigging
has introduced a formatting issue:

Worker 0: actual time=34.779..34.780rows=0 loops=1
Buffers: shared hit=1200
Worker 1: actual time=39.737..39.738rows=0 loops=1
Buffers: shared hit=1084

A space is missing between the time values and the "rows" label.

Patch attached to fix.

Regards

Thom

Attachments:

fix_explain_analyze_spacing.diffapplication/x-patch; name=fix_explain_analyze_spacing.diffDownload
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index c0d614866a..a1395edc8c 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -2075,7 +2075,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
 				ExplainIndentText(es);
 				appendStringInfo(es->str, "actual ");
 				if (es->timing)
-					appendStringInfo(es->str, "time=%.3f..%.3f", startup_ms, total_ms);
+					appendStringInfo(es->str, "time=%.3f..%.3f ", startup_ms, total_ms);
 
 				if (nloops > 1)
 					appendStringInfo(es->str, "rows=%.2f loops=%.0f\n", rows, nloops);
#2Fabrízio de Royes Mello
fabriziomello@gmail.com
In reply to: Thom Brown (#1)
Re: Space missing from EXPLAIN output

On Fri, Feb 28, 2025 at 1:38 PM Thom Brown <thom@linux.com> wrote:

Hi,

Commit ddb17e387aa introduced fractional row counts, but the rejigging
has introduced a formatting issue:

Worker 0: actual time=34.779..34.780rows=0 loops=1
Buffers: shared hit=1200
Worker 1: actual time=39.737..39.738rows=0 loops=1
Buffers: shared hit=1084

A space is missing between the time values and the "rows" label.

Are you sure your main is updated? The current main
is 424ededc580b03e1bcf8aff18a735e519c80061f.

Because your patch is not applying:
main on  main [$]
➜ git apply /tmp/fix_explain_analyze_spacing.diff
error: patch failed: src/backend/commands/explain.c:2075
error: src/backend/commands/explain.c: patch does not apply

On the current main your change should be on line 2041 and not 2075
according to your patch.

Regards,

--
Fabrízio de Royes Mello

#3Thom Brown
thom@linux.com
In reply to: Fabrízio de Royes Mello (#2)
1 attachment(s)
Re: Space missing from EXPLAIN output

On Fri, 28 Feb 2025 at 16:54, Fabrízio de Royes Mello
<fabriziomello@gmail.com> wrote:

On Fri, Feb 28, 2025 at 1:38 PM Thom Brown <thom@linux.com> wrote:

Hi,

Commit ddb17e387aa introduced fractional row counts, but the rejigging
has introduced a formatting issue:

Worker 0: actual time=34.779..34.780rows=0 loops=1
Buffers: shared hit=1200
Worker 1: actual time=39.737..39.738rows=0 loops=1
Buffers: shared hit=1084

A space is missing between the time values and the "rows" label.

Are you sure your main is updated? The current main is 424ededc580b03e1bcf8aff18a735e519c80061f.

Because your patch is not applying:
main on  main [$]
➜ git apply /tmp/fix_explain_analyze_spacing.diff
error: patch failed: src/backend/commands/explain.c:2075
error: src/backend/commands/explain.c: patch does not apply

On the current main your change should be on line 2041 and not 2075 according to your patch.

Erk, yes, my main wasn't up-to-date. Thanks for pointing that out.

Rebased and attached.

Thom

Attachments:

fix_explain_analyze_spacing_v2.diffapplication/x-patch; name=fix_explain_analyze_spacing_v2.diffDownload
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 7e4432f080..d8a7232ced 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -2038,7 +2038,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
 				ExplainIndentText(es);
 				appendStringInfo(es->str, "actual ");
 				if (es->timing)
-					appendStringInfo(es->str, "time=%.3f..%.3f", startup_ms, total_ms);
+					appendStringInfo(es->str, "time=%.3f..%.3f ", startup_ms, total_ms);
 
 				appendStringInfo(es->str, "rows=%.2f loops=%.0f\n", rows, nloops);
 			}
#4Robert Haas
robertmhaas@gmail.com
In reply to: Thom Brown (#3)
Re: Space missing from EXPLAIN output

On Fri, Feb 28, 2025 at 12:12 PM Thom Brown <thom@linux.com> wrote:

Rebased and attached.

Thanks, committed. Sorry for the mistake and thanks for the patch.

--
Robert Haas
EDB: http://www.enterprisedb.com

#5Ilia Evdokimov
ilya.evdokimov@tantorlabs.com
In reply to: Robert Haas (#4)
1 attachment(s)
Re: Space missing from EXPLAIN output

On 28.02.2025 21:08, Robert Haas wrote:

On Fri, Feb 28, 2025 at 12:12 PM Thom Brown <thom@linux.com> wrote:

Rebased and attached.

Thanks, committed. Sorry for the mistake and thanks for the patch.

Hi hackers,

First of all, sorry about the space issue - that was my oversight.

I also just noticed another documentation mistake on my part regarding
the fractional rows display [0]/messages/by-id/40663fc5-edac-4b45-a2aa-a76976700ed9@tantorlabs.com. In one place, I forgot to append '.00'.
I overlooked this because, in my local branch, this change was already
committed as part of my local previous patches, so it didn't show up in
the diff.

Apologies for the oversight! I've attached a fix for this on last commit
7717f63.

[0]: /messages/by-id/40663fc5-edac-4b45-a2aa-a76976700ed9@tantorlabs.com
/messages/by-id/40663fc5-edac-4b45-a2aa-a76976700ed9@tantorlabs.com

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC.

Attachments:

fix_doc_analyze_rows_fractional.difftext/x-patch; charset=UTF-8; name=fix_doc_analyze_rows_fractional.diffDownload
diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml
index be4b49f62b..91feb59abd 100644
--- a/doc/src/sgml/perform.sgml
+++ b/doc/src/sgml/perform.sgml
@@ -730,7 +730,7 @@ WHERE t1.unique1 &lt; 10 AND t1.unique2 = t2.unique2;
          -&gt;  Bitmap Index Scan on tenk1_unique1  (cost=0.00..4.36 rows=10 width=0) (actual time=0.004..0.004 rows=10.00 loops=1)
                Index Cond: (unique1 &lt; 10)
                Buffers: shared hit=2
-   -&gt;  Index Scan using tenk2_unique2 on tenk2 t2  (cost=0.29..7.90 rows=1 width=244) (actual time=0.003..0.003 rows=1 loops=10)
+   -&gt;  Index Scan using tenk2_unique2 on tenk2 t2  (cost=0.29..7.90 rows=1 width=244) (actual time=0.003..0.003 rows=1.00 loops=10)
          Index Cond: (unique2 = t1.unique2)
          Buffers: shared hit=24 read=6
  Planning:
#6Fabrízio de Royes Mello
fabriziomello@gmail.com
In reply to: Ilia Evdokimov (#5)
Re: Space missing from EXPLAIN output

On Fri, Feb 28, 2025 at 4:48 PM Ilia Evdokimov <
ilya.evdokimov@tantorlabs.com> wrote:

On 28.02.2025 21:08, Robert Haas wrote:

On Fri, Feb 28, 2025 at 12:12 PM Thom Brown <thom@linux.com> wrote:

Rebased and attached.

Thanks, committed. Sorry for the mistake and thanks for the patch.

Hi hackers,

First of all, sorry about the space issue - that was my oversight.

I also just noticed another documentation mistake on my part regarding
the fractional rows display [0]. In one place, I forgot to append '.00'.
I overlooked this because, in my local branch, this change was already
committed as part of my local previous patches, so it didn't show up in
the diff.

Apologies for the oversight! I've attached a fix for this on last commit
7717f63.

[0]:

/messages/by-id/40663fc5-edac-4b45-a2aa-a76976700ed9@tantorlabs.com

LGTM

--
Fabrízio de Royes Mello

#7Robert Haas
robertmhaas@gmail.com
In reply to: Fabrízio de Royes Mello (#6)
Re: Space missing from EXPLAIN output

On Fri, Feb 28, 2025 at 4:06 PM Fabrízio de Royes Mello
<fabriziomello@gmail.com> wrote:

On Fri, Feb 28, 2025 at 4:48 PM Ilia Evdokimov <ilya.evdokimov@tantorlabs.com> wrote:

Apologies for the oversight! I've attached a fix for this on last commit
7717f63.

LGTM

Committed.

--
Robert Haas
EDB: http://www.enterprisedb.com