Re: Planner debug views - Mailing list pgsql-hackers

From Qingqing Zhou
Subject Re: Planner debug views
Date
Msg-id CAJjS0u0Ry7mxReG0or7qfd8HD3MmgYeQsp3mzJrbYc5YFgcWAw@mail.gmail.com
Whole thread Raw
In response to Re: Planner debug views  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Planner debug views
List pgsql-hackers
On Tue, Jul 28, 2015 at 2:43 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> You can do something like that in plpgsql, for example
>
>     declare t text;
>
>     for t in EXPLAIN SELECT ...
>     loop
>        insert into whatever values(t);
>     end loop;
>

I see - this is cool.

There are still something bothering me: EXPLAIN is a mixed output with
original text, rows for RelOptInfo, rows for Paths and possible others
added later. So we have to use 't as text' to receive each line. To do the
insertion, we have to further decompose each text line into fields, and
then do the insertion - seems quite involved with plpgsql programming. So
to simplify user's task, we may end up introduce some function to do this,
like this:

/* EXPLAIN target query and dump records to target tables */
select pg_dump_searchspace('target_table_for_rel',      'target_table_for_paths', 'select ... /* target query */');

Is this something we want?

Regards,
Qingqing



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pg_basebackup and replication slots
Next
From: Peter Eisentraut
Date:
Subject: Re: [PATCH] Reload SSL certificates on SIGHUP