Re: Record queryid when auto_explain.log_verbose is on - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: Record queryid when auto_explain.log_verbose is on
Date
Msg-id 20230116130729.yyqqavea2rj7nlot@jrouhaud
Whole thread Raw
In response to Record queryid when auto_explain.log_verbose is on  (torikoshia <torikoshia@oss.nttdata.com>)
List 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.



pgsql-hackers by date:

Previous
From: Xing Guo
Date:
Subject: Re: PL/Python: Fix return in the middle of PG_TRY() block.
Next
From: Ajin Cherian
Date:
Subject: Re: Support logical replication of DDLs