|From:||Andres Freund <andres(at)anarazel(dot)de>|
|Subject:||ExplainProperty* and units|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
while adding EXPLAIN support for JITing (displaying time spent etc), I
got annoyed by the amount of duplication required. There's a fair amount
if (es->format == EXPLAIN_FORMAT_TEXT)
appendStringInfo(es->str, "Execution time: %.3f ms\n",
1000.0 * totaltime);
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).
The most valid counterargument I see is that in many cases, particularly
inside plans, we have more specific output for text mode anyway. Which
means there we'll not benefit much. But I think that's a) considerably
done due to backward compatibility concerns b) verbosity concerns inside
plans, which obviously can be complicated. Therefore I think it's
perfectly reasonable to avoid specific branches for data that's only
going to be displayed once per plan?
We also could add separate ExplainProperty*Unit(...) functions, but I
don't really see a need.
|Next Message||David Rowley||2018-03-14 00:28:35||Re: ALTER TABLE ADD COLUMN fast default|
|Previous Message||Tatsuo Ishii||2018-03-14 00:26:15||Re: Fixes for missing schema qualifications|