pgsql: Make auto_explain print the query identifier in verbose mode

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make auto_explain print the query identifier in verbose mode
Date: 2023-01-26 03:25:27
Message-ID: E1pKstD-005Vi6-JK@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make auto_explain print the query identifier in verbose mode

When auto_explain.log_verbose is on, auto_explain should print in the
logs plans equivalent to the EXPLAIN (VERBOSE). However, when
compute_query_id is on, query identifiers were not showing up, being
only handled by EXPLAIN (VERBOSE). This brings auto_explain on par with
EXPLAIN regarding that. Note that like EXPLAIN, auto_explain does not
show the query identifier when compute_query_id=regress.

The change is done so as the choice of printing the query identifier is
done in ExplainPrintPlan() rather than in ExplainOnePlan(), to avoid a
duplication of the logic dealing with the query ID. auto_explain is the
only in-core caller of ExplainPrintPlan().

While looking at the area, I have noticed that more consolidation
between EXPLAIN and auto_explain would be in order for the logging of
the plan duration and the buffer usage. This refactoring is left as a
future change.

Author: Atsushi Torikoshi
Reviewed-by: Justin Pryzby, Julien Rouhaud
Discussion: https://postgr.es/m/1ea21936981f161bccfce05765c03bee@oss.nttdata.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9d2d9728b8d546434aade4f9667a59666588edd6

Modified Files
--------------
contrib/auto_explain/t/001_auto_explain.pl | 29 +++++++++++++++++++++++++++
src/backend/commands/explain.c | 32 +++++++++++++++---------------
2 files changed, 45 insertions(+), 16 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2023-01-26 04:27:32 pgsql: Clarify documentation for CLUSTER on partitioned tables.
Previous Message Thomas Munro 2023-01-26 02:31:33 pgsql: Fix rare sharedtuplestore.c corruption.