Re: ExplainProperty* and units

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ExplainProperty* and units
Date: 2018-03-14 17:58:53
Message-ID: 20180314175853.a5h35zfcetmdwlk4@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
v2-0001-Make-ExplainPropertyInteger-accept-64bit-input-re.patch text/x-diff 7.6 KB
v2-0002-Add-unit-parameter-to-ExplainProperty-Integer-Flo.patch text/x-diff 19.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2018-03-14 18:08:19 Re: PATCH: Configurable file mode mask
Previous Message Alvaro Herrera 2018-03-14 17:47:53 Re: User defined data types in Logical Replication