Record queryid when auto_explain.log_verbose is on

From: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Record queryid when auto_explain.log_verbose is on
Date: 2023-01-16 12:36:59
Message-ID: 1ea21936981f161bccfce05765c03bee@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

As far as I read the manual below, auto_explain.log_verbose should
record logs equivalent to VERBOSE option of EXPLAIN.

> -- https://www.postgresql.org/docs/devel/auto-explain.html
> auto_explain.log_verbose controls whether verbose details are printed
> when an execution plan is logged; it's equivalent to the VERBOSE option
> of EXPLAIN.

However, when compute_query_id is on, query identifiers are only printed
when using VERBOSE option of EXPLAIN.

EXPLAIN VERBOSE:
```
=# show auto_explain.log_verbose;
auto_explain.log_verbose
--------------------------
on
(1 row)

=# show compute_query_id;
compute_query_id
------------------
on
(1 row)

=# explain verbose select 1;
QUERY PLAN
------------------------------------------
Result (cost=0.00..0.01 rows=1 width=4)
Output: 1
Query Identifier: -1801652217649936326
(3 rows)
```

auto_explain:
```
LOG: 00000: duration: 0.000 ms plan:
Query Text: explain verbose select 1;
Result (cost=0.00..0.01 rows=1 width=4)
Output: 1
```

Attached patch makes auto_explain also print query identifiers.

What do you think?

--
Regards,

--
Atsushi Torikoshi
NTT DATA CORPORATION

Attachment Content-Type Size
v1-0001-make-auto_explain-record-queryid.patch text/x-diff 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2023-01-16 12:50:57 Re: [PATCH] Clarify the behavior of the system when approaching XID wraparound
Previous Message Alvaro Herrera 2023-01-16 12:23:03 Re: Rethinking the implementation of ts_headline()