Re: Parsing output of EXPLAIN command in PostgreSQL

From: Greg Smith <greg(at)2ndQuadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Parsing output of EXPLAIN command in PostgreSQL
Date: 2011-11-10 22:26:11
Message-ID: 4EBC4F83.2090100@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/10/2011 11:10 AM, Αναστάσιος Αρβανίτης wrote:
> I'm developing an application that requires parsing of
> execution plans (those produced as output by issuing an EXPLAIN [query]
> command). Are you aware of any Java library that I could use for this
> purpose? I found https://github.com/depesz/Pg--Explain but it is built in Perl.
>

There's also a little Javascript program that consumes the JSON version at:

http://www.postgresonline.com/journal/archives/171-pgexplain90formats_part1.html
http://www.postgresonline.com/journal/archives/174-pgexplain90formats_part2.html

> 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.
>

That's the easiest way to solve this problem in Java, and in that case
most of the text-based code in Pg--Explain will just be a distraction.
I know some of the earlier versions of XML EXPLAIN included a "DTD"
option to output that, but I don't see that in the committed code. I'm
not sure where that is at actually; it's a good question.

The only reference to doing this I found was Andrew's blog:
http://people.planetpostgresql.org/andrew/index.php?/archives/32-A-couple-of-nice-tools.html
where he talks about there being a RELAXNG specification for the XML
output. I can't find where that came from either. Andrew?

--
Greg Smith 2ndQuadrant US greg(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us

In response to

Responses

Browse pgsql-hackers by date

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