Re: add a new explain option including_query for include query string inside the json plan output

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: add a new explain option including_query for include query string inside the json plan output
Date: 2024-06-25 10:30:27
Message-ID: CAEze2WgJ9kqD2Kj2+=VcyJqqNrpNta2aUEu=MpqjjO4sKEey3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 25 Jun 2024 at 10:55, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
> for json format, add a new option to let the explain json output also
> include the actual query string.

How would this cooperate with e.g. EXPLAIN (...) EXECUTE
my_prepared_statement? Would this query be the prepared statement's
query, or the top-level EXECUTE statement?

> it can make json usage more convenient.
> Now you only need to grab the json output, no need to
> collect another explain statement and extract the actual query from
> the explain statement.

Wouldn't the user be able to keep track of the query they wanted
explained by themselves? If not, why?

> example:
> explain (analyze,including_query on, format json) select 1;
> QUERY PLAN
> -------------------------------------
> [ +
> {"Query": "select 1"}, +
> { +
> "Plan": { +

If we were to add the query to the explain output, I think it should
be a top-level key in the same JSON object that holds the "Plan",
Triggers, and "Execution Time" keys.

Kind regards,

Matthias van de Meent
Neon (https://neon.tech)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-06-25 10:32:59 Re: Backporting BackgroundPsql
Previous Message Heikki Linnakangas 2024-06-25 10:26:23 Backporting BackgroundPsql