1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Fix issues around EXPLAIN with JIT.

I (Andres) was more than a bit hasty in committing 33001fd7a7
after last minute changes, leading to a number of problems (jit output
was only shown for JIT in parallel workers, and just EXPLAIN without
ANALYZE didn't work).  Lukas luckily found these issues quickly.

Instead of combining instrumentation in in standard_ExecutorEnd(), do
so on demand in the new ExplainPrintJITSummary().

Also update a documentation example of the JIT output, changed in
52050ad8eb.

Author: Lukas Fittl, with minor changes by me
Discussion: https://postgr.es/m/CAP53PkxmgJht69pabxBXJBM+0oc6kf3KHMborLP7H2ouJ0CCtQ@mail.gmail.com
Backpatch: 11, where JIT compilation was introduced
This commit is contained in:
Andres Freund
2018-10-03 12:48:37 -07:00
parent 595a0eab7f
commit c03c1449c0
7 changed files with 39 additions and 34 deletions

View File

@ -564,8 +564,7 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
* at a later stage.
*/
if (es->costs)
ExplainPrintJIT(es, queryDesc->estate->es_jit_flags,
queryDesc->estate->es_jit_combined_instr, -1);
ExplainPrintJITSummary(es, queryDesc);
/*
* Close down the query and free resources. Include time for this in the
@ -688,6 +687,32 @@ ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc)
ExplainCloseGroup("Triggers", "Triggers", false, es);
}
/*
* ExplainPrintJITSummary -
* Print summarized JIT instrumentation from leader and workers
*/
void
ExplainPrintJITSummary(ExplainState *es, QueryDesc *queryDesc)
{
JitInstrumentation ji = {0};
if (!(queryDesc->estate->es_jit_flags & PGJIT_PERFORM))
return;
/*
* Work with a copy instead of modifying the leader state, since this
* function may be called twice
*/
if (queryDesc->estate->es_jit)
InstrJitAgg(&ji, &queryDesc->estate->es_jit->instr);
/* If this process has done JIT in parallel workers, merge stats */
if (queryDesc->estate->es_jit_worker_instr)
InstrJitAgg(&ji, queryDesc->estate->es_jit_worker_instr);
ExplainPrintJIT(es, queryDesc->estate->es_jit_flags, &ji, -1);
}
/*
* ExplainPrintJIT -
* Append information about JITing to es->str.