Re: Record queryid when auto_explain.log_verbose is on

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Record queryid when auto_explain.log_verbose is on
Date: 2023-01-16 13:07:29
Message-ID: 20230116130729.yyqqavea2rj7nlot@jrouhaud
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Jan 16, 2023 at 09:36:59PM +0900, torikoshia wrote:
>
> As far as I read the manual below, auto_explain.log_verbose should record
> logs equivalent to VERBOSE option of EXPLAIN.

Ah good catch, that's clearly an oversight!

> Attached patch makes auto_explain also print query identifiers.
>
> What do you think?

@@ -407,6 +408,9 @@ explain_ExecutorEnd(QueryDesc *queryDesc)
ExplainPrintTriggers(es, queryDesc);
if (es->costs)
ExplainPrintJITSummary(es, queryDesc);
+ if (es->verbose && queryDesc->plannedstmt->queryId != UINT64CONST(0))
+ ExplainPropertyInteger("Query Identifier", NULL, (int64)
+ queryDesc->plannedstmt->queryId, es);

For interactive EXPLAIN the query identifier is printed just after the plan,
before the triggers and the JIT summary so auto_explain should do the same.

Other than that looks good to me.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2023-01-16 13:07:48 Re: The documentation for storage type 'plain' actually allows single byte header
Previous Message Xing Guo 2023-01-16 13:03:43 Re: PL/Python: Fix return in the middle of PG_TRY() block.