Re: proposal - queryid can be used as filter for auto_explain

From: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: proposal - queryid can be used as filter for auto_explain
Date: 2026-06-18 11:38:23
Message-ID: CAKZiRmxV8A5rMd=hXLqartFtVhkyxkDKah0OQnaypyJUK_HJbg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Pavel,

On Wed, Jun 17, 2026 at 9:21 AM Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>
> Hi
>
> small change - parsing queryid by usage pg_strtoint64_safe instead strtol
>

+ DefineCustomStringVariable("auto_explain.log_queryids",
+ "Only
queries with qyeryid from list will be logged.",

Other than this 'qyeryid' typo I don't see anything obviously wrong. Well
maybe if we are scared about too heavy impact of scanning too long array
of queryids, we could enforce some max limitation there on the count
accepted (but I'm not sure if it is worth it).

+ if (log_filter && msec >= auto_explain_log_min_duration)

With QA hat on: maybe it would be possible to emit some warning message
if log_queryids is set to anything and auto_explain_log_min_duration is
at the default of -1? (because that way nothing gets logged). My first
impression when using was If I would enable it .log_queryids would work
out of the box, but of course due to this line of code both criteria
need to be meet, but emitting some HINT when just .log_queryids would be
set would be more user firendly (yes, it's covered in the docs, but people
rarely check it).

Anyway, it looks like very useful addition to me.

-J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2026-06-18 11:46:27 Re: [PATCH] Fix segmentation fault and infinite loop in jsonb_{plperl,plpython}
Previous Message Nazir Bilal Yavuz 2026-06-18 11:37:13 Re: Heads Up: cirrus-ci is shutting down June 1st