pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Souvik Bhattacherjee <kivuosb@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Is it possible to store the output of EXPLAIN into a table
Date: Mon, 22 Apr 2019 12:02:01 -0400
Message-ID: <15374.1555948921@sss.pgh.pa.us> (raw)
In-Reply-To: <CAANrPSdL9YpU0hqm=YfPUQKHVXrSCVTRO-5QekEDdEmNv5UbEA@mail.gmail.com>
References: <CAANrPSdL9YpU0hqm=YfPUQKHVXrSCVTRO-5QekEDdEmNv5UbEA@mail.gmail.com>

Souvik Bhattacherjee <kivuosb@gmail.com> writes:
> I was just wondering if it is possible to store the output of EXPLAIN into
> a table.

EXPLAIN won't do that directly, but you could make a plpgsql function
along the lines of

      for t in execute explain ...
         return next t;

(too lazy to check the exact details here, but I believe you can find
related examples in our regression tests) and then store the function's
result into a table.

			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <15374.1555948921@sss.pgh.pa.us>
Permalink:  ../15374.1555948921@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15374.1555948921@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, kivuosb@gmail.com
  Subject: Re: Is it possible to store the output of EXPLAIN into a table
  In-Reply-To: <15374.1555948921@sss.pgh.pa.us>
  References: <CAANrPSdL9YpU0hqm=YfPUQKHVXrSCVTRO-5QekEDdEmNv5UbEA@mail.gmail.com> <15374.1555948921@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox