Re: Auto explain after query timeout

From: James Coleman <jtc331(at)gmail(dot)com>
To: Gurjeet <singh(dot)gurjeet(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Auto explain after query timeout
Date: 2022-09-20 18:34:48
Message-ID: CAAaqYe9EkQ5LMRvOEyTCz1QaCTONSvSr68zadMyaOqGt5OOSjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 20, 2022 at 2:12 PM Gurjeet <singh(dot)gurjeet(at)gmail(dot)com> wrote:
>
> On Tue Sep 20, 2022 at 10:34 AM PDT, James Coleman wrote:
> > Hopefully I'm not missing something obvious, but as far as I know
> > there's no way to configure auto explain to work fire
> > statement_timeout fires.
>
> I believe you're correct.
>
> > I'd like to look into this at some point, but I'm wondering if anyone
> > has thought about it before, and, if so, is there any obvious
> > impediment to doing so?
>
> This would be a neat feature. Since the changes would be fairly
> localized to the contrib module, this would be a great first patch for
> someone new to contributing.
>
> This can be exposed at a new GUC auto_explain.log_on_statement_timeout.
> I wish our conventions allowed for creating hierarchies of GUC
> parameters, e.g. auto_explain.when.statmeent_timeout.
>
> For someone who would like to achieve this in the field today, I believe
> they can set auto_explain.log_min_duration equal to, or less than,
> statement_timeout.

Either I'm missing something (and/or this was fixed in a later PG
version), but I don't think this is how it works. We have this
specific problem now: we set auto_explain.log_min_duration to 200 (ms)
and statement_timeout set to 30s, but when a statement times out we do
not get the plan logged with auto-explain.

James Coleman

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2022-09-20 18:51:44 Re: Support tls-exporter as channel binding for TLSv1.3
Previous Message Nathan Bossart 2022-09-20 18:32:02 Re: XMAX_LOCK_ONLY and XMAX_COMMITTED (fk/multixact code)