Re: Is it possible to store the output of EXPLAIN into a table

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Souvik Bhattacherjee <kivuosb(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Is it possible to store the output of EXPLAIN into a table
Date: 2019-04-22 15:59:08
Message-ID: 20190422155908.tnlrajxuwmu6cg2s@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 22, 2019 at 11:27:18AM -0400, Souvik Bhattacherjee wrote:
> Hi,
>
> I was just wondering if it is possible to store the output of EXPLAIN into a
> table.
>
>
> create temp table mytab as (select * from (explain select * from table1 where
> attr = 5) t);
>
>
> Unfortunately, the query above does not work.

I had to do this one and put the EXPLAIN in a function and then called
the function and captured the output, see this and following slides:

http://momjian.us/main/writings/pgsql/optimizer.pdf#page=11

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2019-04-22 16:01:01 Re: Is it possible to store the output of EXPLAIN into a table
Previous Message Adrian Klaver 2019-04-22 15:54:22 Re: Resetting identity columns