Re: Parsing output of EXPLAIN command in PostgreSQL

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: Αναστάσιος Αρβανίτης <tasosarvanitis(at)yahoo(dot)gr>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parsing output of EXPLAIN command in PostgreSQL
Date: 2011-11-10 22:42:18
Message-ID: 4EBC534A.8000000@proxel.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2011-11-10 17:23, Αναστάσιος Αρβανίτης wrote:
> Also another option I am considering is to use EXPLAIN [query] FORMAT XML which is available in PostgreSQL 9.1. However, in that case it
> would better to have the XML Schema of the generated plans available.
>
> Is there any other solution I am not aware of?

Hi,

I recommend using the XML, JSON or YAML version of the plan, whichever
is easiest in your programming language to parse. I do not think anyone
has written a formal schema yet for the XML but it still should be much
easier to parse than rolling your own parser for the human readable format.

But if you insist on parsing the human readable format, e.g. to support
versions before 9.1, I recommend that you take a look at
http://explain.depesz.com/ which supports parsing text plans in addition
to XML and JSON. The site is open source and written in Perl.

The source code can be found at:

https://github.com/depesz/Pg--Explain

Best regards,
Andreas

--
Andreas Karlsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-11-10 22:45:10 Re: Disable OpenSSL compression
Previous Message Bruce Momjian 2011-11-10 22:39:18 Re: Disable OpenSSL compression