From: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Add parameter jit_warn_above_fraction |
Date: | 2022-02-25 16:23:04 |
Message-ID: | 20220225162304.GD9008@telsasoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Feb 25, 2022 at 04:16:01PM +0100, Magnus Hagander wrote:
> + {
> + {"jit_warn_above_fraction", PGC_SUSET, LOGGING_WHEN,
> + gettext_noop("Sets the fraction of query time spent on JIT before writing"
> + "a warning to the log."),
> + gettext_noop("Write a message tot he server log if more than this"
> + "fraction of the query runtime is spent on JIT."
> + "Zero turns off the warning.")
> + },
> + &jit_warn_above_fraction,
> + 0.0, 0.0, 1.0,
> + NULL, NULL, NULL
> + },
Should be PGC_USERSET ?
+ gettext_noop("Write a message tot he server log if more than this"
to the
+ if (jit_enabled && jit_warn_above_fraction > 0)
+ {
+ int64 jit_time =
+ INSTR_TIME_GET_MILLISEC(portal->queryDesc->estate->es_jit->instr.generation_counter) +
+ INSTR_TIME_GET_MILLISEC(portal->queryDesc->estate->es_jit->instr.inlining_counter) +
+ INSTR_TIME_GET_MILLISEC(portal->queryDesc->estate->es_jit->instr.optimization_counter) +
+ INSTR_TIME_GET_MILLISEC(portal->queryDesc->estate->es_jit->instr.emission_counter);
+
+ if (jit_time > msecs * jit_warn_above_fraction)
+ {
+ ereport(WARNING,
+ (errmsg("JIT time was %ld ms of %d ms",
+ jit_time, msecs)));
+ }
+ }
I think it should be a NOTICE (or less?)
Is it more useful if this is applied combined with log_min_duration_statement ?
It's easy to imagine a query for which the planner computes a high cost, but
actually runs quickly. You might get a bunch of WARNINGs that the query took
10 MS and JIT was 75% of that, even if you don't care about queries that take
less than 10 SEC.
I should say that this is already available by processing the output of
autoexplain.
--
Justin
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2022-02-25 16:26:45 | Re: Readd use of TAP subtests |
Previous Message | Andres Freund | 2022-02-25 16:20:43 | Re: Add parameter jit_warn_above_fraction |