auto_explain: Include JIT information if applicable.
authorAndres Freund <andres@anarazel.de>
Mon, 24 Sep 2018 20:40:57 +0000 (13:40 -0700)
committerAndres Freund <andres@anarazel.de>
Mon, 24 Sep 2018 20:40:57 +0000 (13:40 -0700)
Due to my (Andres') omission auto_explain did not include information
about JIT compilation. Fix that.

Author: Lukas Fittl
Discussion:
https://postgr.es/m/CAP53PkzgSyoTCau0-5FNaM484B=uO8nLzma7L1ncWLb1=oVJQA@mail.gmail.com
Backpatch: 11-, where JIT compilation was introduced

contrib/auto_explain/auto_explain.c

index 76f293cbf4ac5977b580b0264b9d53dac18734dd..0c0eb3fb9e00b5d9f3ea783ebe279aaf8e954669 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "commands/explain.h"
 #include "executor/instrument.h"
+#include "jit/jit.h"
 #include "utils/guc.h"
 
 PG_MODULE_MAGIC;
@@ -361,6 +362,9 @@ explain_ExecutorEnd(QueryDesc *queryDesc)
            ExplainPrintPlan(es, queryDesc);
            if (es->analyze && auto_explain_log_triggers)
                ExplainPrintTriggers(es, queryDesc);
+           if (queryDesc->estate->es_jit && es->costs &&
+               queryDesc->estate->es_jit->created_functions > 0)
+               ExplainPrintJIT(es, queryDesc);
            ExplainEndOutput(es);
 
            /* Remove last line break */