Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kTrm1-0008O0-HX for pgsql-hackers@arkaria.postgresql.org; Sat, 17 Oct 2020 19:21:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kTrlz-0006TX-PM for pgsql-hackers@arkaria.postgresql.org; Sat, 17 Oct 2020 19:21:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kTrlz-0006Sp-Dl for pgsql-hackers@lists.postgresql.org; Sat, 17 Oct 2020 19:21:47 +0000 Received: from mail-il1-x141.google.com ([2607:f8b0:4864:20::141]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kTrlr-0007g7-Hg for pgsql-hackers@postgresql.org; Sat, 17 Oct 2020 19:21:46 +0000 Received: by mail-il1-x141.google.com with SMTP id j13so6377982ilc.4 for ; Sat, 17 Oct 2020 12:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qIa/CakTJLQ7vlKWp3cQoU4t2UQgGD3fIi+c7zuylTI=; b=Q7VWaTHKLxyCWFVIfWjYAJcVw7ZeqKj/HInJlFIZRZjYR0leA55cXCNRT188XdTlTE QaYXeV9+rQcmVZ+FYGMrDRpC8TICEtsuAdik58wksalgVwUoHb+7RY8lkxk1okJj/gIA Puovfg0fRu01stNs7jEWOODoWxr0hRYuOfQo/pcdPED4ZUli07XVNfyXaObQpj4tgoXM p78v8xxpHbJ6srKS91oLNWc5DJItO6+0J2ZkwtpaBHy2m3bBNBx5WFrjfnoKy+Vm9PkW HFjp5lkiPzHvt5hgrZfAJ6fV80S3ol4ywJXwA5SMle5JEUZItH15WrTpYRYgzrYTEuUR 5fFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qIa/CakTJLQ7vlKWp3cQoU4t2UQgGD3fIi+c7zuylTI=; b=fwCopzXdND/0St+fx/pCFHHBPKAvnpMnIXJnET0fTPYlvqx94c2plAaGV+JNBVIYYa Pe9giVLL3KhIzRQ0lDN0G0Q+sJA+4gesl0gfjpazWNvlnJjKJ9SjVj+56tecyjemgny7 SGAc6gOikJlAbg+cfWnLxRvlRYHuPa5Kw63CmYFbQialtIyr2QByJD+IsJSjYcpBB2zS 3/zEqDML3UbT+APg/bT1VL8HZWX9vMzy0b86wLRwpVSU0IQrHbPFvJss62S+YgUbDUyJ sNG05P5S57TK+k3qvv+A7Z7JIYgocBZ67XBo+ai7gxTNXnYcLGkr47k6saBJZJ/rUMgf yWcg== X-Gm-Message-State: AOAM530jgNytLt5pGV6e359KpTrj7GrCQw+n8a5qLJ8plTBW9dMT+dAF dXQ/dSdl/DEyzXhKAaz+dSjz5Q== X-Google-Smtp-Source: ABdhPJwfigzA3Gib3jk7rV64ONZJM0a+c5pvjxzxDjpWfXLRYGF64XNUA3oG5MXLC83YBjV7wyE3Cg== X-Received: by 2002:a92:c88b:: with SMTP id w11mr6627082ilo.56.1602962497139; Sat, 17 Oct 2020 12:21:37 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id z20sm5298117ior.2.2020.10.17.12.21.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Oct 2020 12:21:36 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id C556280065B; Sat, 17 Oct 2020 14:21:34 -0500 (CDT) Date: Sat, 17 Oct 2020 14:21:34 -0500 From: Justin Pryzby To: David Rowley Cc: Tom Lane , pgsql-hackers@postgresql.org, Andres Freund Subject: Re: jit and explain nontext Message-ID: <20201017192134.GD9241@telsasoft.com> References: <20201014193859.GS9241@telsasoft.com> <3643530.1602724513@sss.pgh.pa.us> <20201015014326.GU9241@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="veXX9dWIonWZEC6h" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --veXX9dWIonWZEC6h Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Oct 15, 2020 at 02:51:38PM +1300, David Rowley wrote: > On Thu, 15 Oct 2020 at 14:43, Justin Pryzby wrote: > > On Thu, Oct 15, 2020 at 02:23:01PM +1300, David Rowley wrote: > > > On Thu, 15 Oct 2020 at 14:15, Tom Lane wrote: > > > > Hmm, I dunno if my opinion counts as "wisdom", but what I was arguing for > > > > there was that we should print stuff if it's potentially invoked by a > > > > run-time decision, but not if it was excluded at plan time. I'm not > > > > totally clear on whether jitting decisions are fixed by the plan tree > > > > (including its cost values) or if the executor can make different > > > > decisions in different executions of the identical plan tree. > > > > If the latter, then I agree with Justin that this is a bug. > > > > > > As far as I know, the only exception where the executor overwrites the > > > planner's decision is in nodeValuesscan.c where it turns jit off > > > because each VALUES will get evaluated just once, which would be a > > > waste of effort to JIT. > > > > > > Apart from that the choice is baked in by the planner and set in > > > PlannedStmt.jitfFlags. > > > > What about the GUCs themselves ? > > > > They can change after planning, which means a given execution of a plan might > > or might not use jit. > > That's a pretty good point. Added at: https://commitfest.postgresql.org/30/2766/ diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 41317f1837..7345971507 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -839,7 +839,8 @@ ExplainPrintJIT(ExplainState *es, int jit_flags, JitInstrumentation *ji) instr_time total_time; /* don't print information if no JITing happened */ - if (!ji || ji->created_functions == 0) + if (!ji || (ji->created_functions == 0 && + es->format == EXPLAIN_FORMAT_TEXT)) return; /* calculate total time */ -- 2.17.0 --veXX9dWIonWZEC6h Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0001-explain-show-JIT-details-in-non-text-format-even-.patch" From 237f4d5d0739583683fd7a4d67a6e3d9120aba04 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Sat, 17 Oct 2020 14:10:11 -0500 Subject: [PATCH v1] explain: show JIT details in non-text format, even if zero --- src/backend/commands/explain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 41317f1837..7345971507 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -839,7 +839,8 @@ ExplainPrintJIT(ExplainState *es, int jit_flags, JitInstrumentation *ji) instr_time total_time; /* don't print information if no JITing happened */ - if (!ji || ji->created_functions == 0) + if (!ji || (ji->created_functions == 0 && + es->format == EXPLAIN_FORMAT_TEXT)) return; /* calculate total time */ -- 2.17.0 --veXX9dWIonWZEC6h--