pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedwrong units in ExplainPropertyFloat
2+ messages / 2 participants
[nested] [flat]
* wrong units in ExplainPropertyFloat
@ 2021-04-15 16:38 Justin Pryzby <pryzby@telsasoft.com>
0 siblings, 1 reply; 2+ messages in thread
From: Justin Pryzby @ 2021-04-15 16:38 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-hackers
|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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: wrong units in ExplainPropertyFloat
@ 2021-04-16 15:32 Tom Lane <tgl@sss.pgh.pa.us>
parent: Justin Pryzby <pryzby@telsasoft.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2021-04-16 15:32 UTC (permalink / raw)
To: Justin Pryzby <pryzby@telsasoft.com>; +Cc: Andres Freund <andres@anarazel.de>; pgsql-hackers
Justin Pryzby <pryzby@telsasoft.com> writes:
> 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.
Yeah, I concur: these should say "ms", but it's only latent so it's
not surprising nobody's noticed. Pushed.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-04-16 15:32 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 16:38 wrong units in ExplainPropertyFloat Justin Pryzby <pryzby@telsasoft.com>
2021-04-16 15:32 ` Tom Lane <tgl@sss.pgh.pa.us>
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