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@2ndQuadrant.com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us