Re: add a new explain option including_query for include query string inside the json plan output - Mailing list pgsql-hackers

From Matthias van de Meent
Subject Re: add a new explain option including_query for include query string inside the json plan output
Date
Msg-id CAEze2WgJ9kqD2Kj2+=VcyJqqNrpNta2aUEu=MpqjjO4sKEey3Q@mail.gmail.com
Whole thread Raw
In response to add a new explain option including_query for include query string inside the json plan output  (jian he <jian.universality@gmail.com>)
Responses Re: add a new explain option including_query for include query string inside the json plan output
List pgsql-hackers
On Tue, 25 Jun 2024 at 10:55, jian he <jian.universality@gmail.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)



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Backporting BackgroundPsql
Next
From: Heikki Linnakangas
Date:
Subject: Re: Backporting BackgroundPsql