Re: ExplainProperty* and units - Mailing list pgsql-hackers

From Andres Freund
Subject Re: ExplainProperty* and units
Date
Msg-id 20180314175853.a5h35zfcetmdwlk4@alap3.anarazel.de
Whole thread Raw
In response to ExplainProperty* and units  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Hi,

On 2018-03-13 17:27:40 -0700, Andres Freund wrote:
> while adding EXPLAIN support for JITing (displaying time spent etc), I
> got annoyed by the amount of duplication required. There's a fair amount
> of
>     if (es->format == EXPLAIN_FORMAT_TEXT)
>         appendStringInfo(es->str, "Execution time: %.3f ms\n",
>                                          1000.0 * totaltime);
>     else
>         ExplainPropertyFloat("Execution Time", 1000.0 * totaltime,
> which is fairly redundant.
> 
> In the attached *POC* patch I've added a 'unit' parameter to the numeric
> ExplainProperty* functions, which EXPLAIN_FORMAT_TEXT adds to the
> output.  This can avoid the above and other similar branches (of which
> the JIT patch would add a number).

Here's a series of two, a bit more carefully done, patches.  First
removes ExplainPropertyLong, expands ExplainPropertyInteger to
64bits. Second adds the unit argument.

Whether we want to go for the first one, or revise first patch to just
rename ExplainPropertyInt64 remains to be discussed.  I still slightly
prefer the approach presented here.

- Andres

Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: User defined data types in Logical Replication
Next
From: David Steele
Date:
Subject: Re: PATCH: Configurable file mode mask