pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Justin Pryzby <pryzby@telsasoft.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org
Subject: wrong units in ExplainPropertyFloat
Date: Thu, 15 Apr 2021 11:38:46 -0500
Message-ID: <20210415163846.GA3315@telsasoft.com> (raw )
|commit 7a50bb690b4837d29e715293c156cff2fc72885c
|Author: Andres Freund <andres@anarazel.de>
|Date: Fri Mar 16 23:13:12 2018 -0700
|
| Add 'unit' parameter to ExplainProperty{Integer,Float}.
|
| This allows to deduplicate some existing code, but mainly avoids some
| duplication in upcoming commits.
|
| In passing, fix variable names indicating wrong unit (seconds instead
| of ms).
|
| Author: Andres Freund
| Discussion: https://postgr.es/m/20180314002740.cah3mdsonz5mxney@alap3.anarazel.de
@@ -1304,8 +1299,8 @@ ExplainNode(PlanState *planstate, List *ancestors,
planstate->instrument && planstate->instrument->nloops > 0)
{
double nloops = planstate->instrument->nloops;
- double startup_sec = 1000.0 * planstate->instrument->startup / nloops;
- double total_sec = 1000.0 * planstate->instrument->total / nloops;
+ double startup_ms = 1000.0 * planstate->instrument->startup / nloops;
+ double total_ms = 1000.0 * planstate->instrument->total / nloops;
...
if (es->timing)
{
- ExplainPropertyFloat("Actual Startup Time", startup_sec, 3, es);
- ExplainPropertyFloat("Actual Total Time", total_sec, 3, es);
+ ExplainPropertyFloat("Actual Startup Time", "s", startup_ms,
+ 3, es);
+ ExplainPropertyFloat("Actual Total Time", "s", total_ms,
+ 3, es);
There's 3 pairs of these, and the other two pairs use "ms":
$ git grep 'Actual.*Time' src/backend/commands/explain.c
src/backend/commands/explain.c: ExplainPropertyFloat("Actual Startup Time", "s", startup_ms,
src/backend/commands/explain.c: ExplainPropertyFloat("Actual Total Time", "s", total_ms,
src/backend/commands/explain.c: ExplainPropertyFloat("Actual Startup Time", "ms", 0.0, 3, es);
src/backend/commands/explain.c: ExplainPropertyFloat("Actual Total Time", "ms", 0.0, 3, es);
src/backend/commands/explain.c: ExplainPropertyFloat("Actual Startup Time", "ms",
src/backend/commands/explain.c: ExplainPropertyFloat("Actual Total Time", "ms",
Text mode uses appendStringInfo() for high density output, so this only affects
non-text output, but it turns out that units aren't shown for nontext format
anyway - this seems like a deficiency, but it means there's no visible bug.
--
Justin
view thread (2+ messages) latest in thread
Message-ID: <20210415163846.GA3315@telsasoft.com>
Permalink: ../20210415163846.GA3315@telsasoft.com/
Also on: postgresql.org/message-id/20210415163846.GA3315@telsasoft.com
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, andres@anarazel.de
Subject: Re: wrong units in ExplainPropertyFloat
In-Reply-To: <20210415163846.GA3315@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox