dont_jit_with_explain_only.patch

application/octet-stream

Filename: dont_jit_with_explain_only.patch
Type: application/octet-stream
Part: 0
Message: Re: BUG #17871: JIT during postgresql_fdw remote_estimates EXPLAIN have very negatively effect on planning time

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/backend/jit/jit.c 5 0
diff --git a/src/backend/jit/jit.c b/src/backend/jit/jit.c
index fd1cf184c8..b30d0eb0b6 100644
--- a/src/backend/jit/jit.c
+++ b/src/backend/jit/jit.c
@@ -22,6 +22,7 @@
 #include <unistd.h>
 
 #include "executor/execExpr.h"
+#include "executor/executor.h"
 #include "fmgr.h"
 #include "jit/jit.h"
 #include "miscadmin.h"
@@ -164,6 +165,10 @@ jit_compile_expr(struct ExprState *state)
 	if (!state->parent)
 		return false;
 
+	/* don't do any jit compilation if we're only doing EXPLAIN */
+	if ((state->parent->state->es_top_eflags & EXEC_FLAG_EXPLAIN_ONLY))
+		return false;
+
 	/* if no jitting should be performed at all */
 	if (!(state->parent->state->es_jit_flags & PGJIT_PERFORM))
 		return false;