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