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